ArmNN
 24.08
LayersFwd.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "InternalTypes.hpp"
8 
10 #include "layers/AdditionLayer.hpp"
16 #include "layers/CastLayer.hpp"
19 #include "layers/ConcatLayer.hpp"
20 #include "layers/ConstantLayer.hpp"
25 #include "layers/DebugLayer.hpp"
30 #include "layers/DivisionLayer.hpp"
34 #include "layers/FillLayer.hpp"
35 #include "layers/FloorLayer.hpp"
37 #include "layers/FusedLayer.hpp"
38 #include "layers/GatherLayer.hpp"
39 #include "layers/GatherNdLayer.hpp"
40 #include "layers/InputLayer.hpp"
45 #include "layers/LstmLayer.hpp"
46 #include "layers/MapLayer.hpp"
47 #include "layers/MaximumLayer.hpp"
48 #include "layers/MeanLayer.hpp"
49 #include "layers/MemCopyLayer.hpp"
51 #include "layers/MergeLayer.hpp"
52 #include "layers/MinimumLayer.hpp"
55 #include "layers/OutputLayer.hpp"
56 #include "layers/PadLayer.hpp"
57 #include "layers/PermuteLayer.hpp"
61 #include "layers/PreluLayer.hpp"
62 #include "layers/QuantizeLayer.hpp"
63 #include "layers/QLstmLayer.hpp"
65 #include "layers/RankLayer.hpp"
66 #include "layers/ReduceLayer.hpp"
67 #include "layers/ReshapeLayer.hpp"
68 #include "layers/ResizeLayer.hpp"
71 #include "layers/ShapeLayer.hpp"
72 #include "layers/SliceLayer.hpp"
73 #include "layers/SoftmaxLayer.hpp"
76 #include "layers/SplitterLayer.hpp"
77 #include "layers/StackLayer.hpp"
78 #include "layers/StandInLayer.hpp"
81 #include "layers/SwitchLayer.hpp"
82 #include "layers/TileLayer.hpp"
86 #include "layers/UnmapLayer.hpp"
87 
88 namespace armnn
89 {
90 
91 template <LayerType Type>
93 
94 template <LayerType Type>
96 
97 template <typename T>
98 constexpr LayerType LayerEnumOf(const T* = nullptr);
99 
100 #define DECLARE_LAYER_IMPL(_, LayerName) \
101  class LayerName##Layer; \
102  template <> \
103  struct LayerTypeOfImpl<LayerType::_##LayerName> \
104  { \
105  using Type = LayerName##Layer; \
106  }; \
107  template <> \
108  constexpr LayerType LayerEnumOf(const LayerName##Layer*) \
109  { \
110  return LayerType::_##LayerName; \
111  }
112 
113 #define DECLARE_LAYER(LayerName) DECLARE_LAYER_IMPL(, LayerName)
114 
116 DECLARE_LAYER(Addition)
119 DECLARE_LAYER(BatchNormalization)
121 DECLARE_LAYER(BroadcastTo)
123 DECLARE_LAYER(ChannelShuffle)
124 DECLARE_LAYER(Comparison)
126 DECLARE_LAYER(Constant)
127 DECLARE_LAYER(ConvertFp16ToFp32)
128 DECLARE_LAYER(ConvertFp32ToFp16)
129 DECLARE_LAYER(Convolution2d)
130 DECLARE_LAYER(Convolution3d)
133 DECLARE_LAYER(DepthwiseConvolution2d)
136 DECLARE_LAYER(Division)
137 DECLARE_LAYER(ElementwiseBinary)
138 DECLARE_LAYER(ElementwiseUnary)
145 DECLARE_LAYER(GatherNd)
147 DECLARE_LAYER(InstanceNormalization)
148 DECLARE_LAYER(L2Normalization)
149 DECLARE_LAYER(LogicalBinary)
156 DECLARE_LAYER(MemImport)
159 DECLARE_LAYER(Multiplication)
160 DECLARE_LAYER(Normalization)
166 DECLARE_LAYER(PreCompiled)
170 DECLARE_LAYER(QuantizedLstm)
186 DECLARE_LAYER(Subtraction)
190 DECLARE_LAYER(TransposeConvolution2d)
191 DECLARE_LAYER(UnidirectionalSequenceLstm)
193 }
armnnUtils::Transpose
void Transpose(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
Definition: Transpose.cpp:153
DepthToSpaceLayer.hpp
ChannelShuffleLayer.hpp
DetectionPostProcessLayer.hpp
FullyConnectedLayer.hpp
SoftmaxLayer.hpp
ElementwiseBinaryLayer.hpp
ComparisonLayer.hpp
armnn::Splitter
void Splitter(const SplitterQueueDescriptor &data, std::vector< ITensorHandle * > inputs, std::vector< ITensorHandle * > outputs)
Definition: Splitter.hpp:17
MinimumLayer.hpp
armnn::Pooling2d
void Pooling2d(Decoder< float > &rInputDecoder, Encoder< float > &rOutputEncoder, const TensorInfo &inputInfo, const TensorInfo &outputInfo, const Pooling2dDescriptor &params)
Computes the Pooling2d operation.
Definition: Pooling2d.cpp:142
FillLayer.hpp
ActivationLayer.hpp
ArgMinMaxLayer.hpp
SubtractionLayer.hpp
DECLARE_LAYER
#define DECLARE_LAYER(LayerName)
Definition: LayersFwd.hpp:113
RankLayer.hpp
AdditionLayer.hpp
MapLayer.hpp
BatchMatMulLayer.hpp
ShapeLayer.hpp
armnn::Reduce
void Reduce(const TensorInfo &inputInfo, const TensorInfo &outputInfo, Decoder< float > &input, Encoder< float > &output, const std::vector< uint32_t > axis, const ReduceOperation reduceOperation)
Definition: Reduce.cpp:70
ResizeLayer.hpp
ReverseV2Layer.hpp
TransposeLayer.hpp
LogSoftmaxLayer.hpp
PadLayer.hpp
armnn::LogSoftmax
void LogSoftmax(Decoder< float > &input, Encoder< float > &output, const TensorInfo &inputInfo, const LogSoftmaxDescriptor &descriptor)
Definition: LogSoftmax.cpp:27
InstanceNormalizationLayer.hpp
Convolution3dLayer.hpp
armnnUtils::Permute
void Permute(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
Definition: Permute.cpp:164
TileLayer.hpp
UnmapLayer.hpp
armnn::Stack
void Stack(const StackQueueDescriptor &data, std::vector< std::unique_ptr< Decoder< float >>> &inputs, Encoder< float > &output, const TensorInfo &inputInfo, const TensorInfo &outputInfo)
Definition: Stack.cpp:12
armnn::BatchToSpaceNd
void BatchToSpaceNd(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const BatchToSpaceNdDescriptor &params, Decoder< float > &inputData, Encoder< float > &outputData)
Definition: BatchToSpaceNd.cpp:50
FusedLayer.hpp
ReduceLayer.hpp
armnn::FullyConnected
void FullyConnected(const TensorShape &rInputShape, Decoder< float > &rInputDecoder, const TensorShape &rOutputShape, Encoder< float > &rOutputEncoder, const TensorShape &rWeightsShape, Decoder< float > &rWeightDecoder, Decoder< float > *pBiasDecoder, const bool biasEnabled, const unsigned int K, const bool transposeWeights)
Performs a matrix multiplication and optionally adds a bias.
Definition: FullyConnected.cpp:13
SpaceToDepthLayer.hpp
PermuteLayer.hpp
armnn::Pooling3d
void Pooling3d(Decoder< float > &rInputDecoder, Encoder< float > &rOutputEncoder, const TensorInfo &inputInfo, const TensorInfo &outputInfo, const Pooling3dDescriptor &params)
Computes the Pooling3d operation.
Definition: Pooling3d.cpp:172
armnn::LayerTypeOfImpl
Definition: LayersFwd.hpp:92
CastLayer.hpp
Convolution2dLayer.hpp
armnn::Fill
void Fill(Encoder< float > &output, const TensorShape &desiredOutputShape, const float value)
Creates a tensor and fills it with a scalar value.
Definition: Fill.cpp:13
DivisionLayer.hpp
PreluLayer.hpp
armnn::ReverseV2
void ReverseV2(const TensorInfo &inputInfo, const TensorInfo &axisInfo, Decoder< float > &inputDecoder, Decoder< int > &axisDecoder, Encoder< float > &outputEncoder)
Definition: ReverseV2Impl.cpp:78
GatherLayer.hpp
GatherNdLayer.hpp
MaximumLayer.hpp
armnn::Slice
void Slice(const TensorInfo &inputInfo, const SliceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
Definition: Slice.cpp:14
MergeLayer.hpp
BatchNormalizationLayer.hpp
armnn::ArgMinMax
void ArgMinMax(Decoder< float > &in, OUT *out, const TensorInfo &inputTensorInfo, const TensorInfo &outputTensorInfo, ArgMinMaxFunction function, int axis)
Definition: ArgMinMax.cpp:17
PreCompiledLayer.hpp
QuantizedLstmLayer.hpp
armnn::Dequantize
float Dequantize(QuantizedType value, float scale, int32_t offset)
Dequantize an 8-bit data type into a floating point data type.
Definition: TypesUtils.cpp:48
LstmLayer.hpp
QLstmLayer.hpp
TransposeConvolution2dLayer.hpp
armnn::Softmax
void Softmax(Decoder< float > &in, Encoder< float > &out, const TensorInfo &inputTensorInfo, float beta, int axis)
Computes the softmax function on some inputs, into outputs, with a shape given by tensorInfo.
Definition: Softmax.cpp:17
armnn::SpaceToDepth
void SpaceToDepth(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const SpaceToDepthDescriptor &params, Decoder< float > &inputData, Encoder< float > &outputData)
Definition: SpaceToDepth.cpp:36
armnn::SpaceToBatchNd
void SpaceToBatchNd(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const SpaceToBatchNdDescriptor &params, Decoder< float > &inputData, Encoder< float > &outputData)
Definition: SpaceToBatchNd.cpp:48
SliceLayer.hpp
armnn::Quantize
QuantizedType Quantize(float value, float scale, int32_t offset)
Quantize a floating point data type into an 8-bit data type.
Definition: TypesUtils.cpp:30
armnn::Tile
void Tile(const TileDescriptor &params, const TensorInfo &inputInfo, Decoder< float > &inputDecoder, Encoder< float > &outputEncoder)
Definition: Tile.cpp:45
MemCopyLayer.hpp
armnn::ScatterNd
void ScatterNd(const TensorInfo &inputInfo, const TensorInfo &indicesInfo, const TensorInfo &updatesInfo, Decoder< float > &input, Decoder< int > &indices, Decoder< float > &updates, Encoder< float > &output, ScatterNdDescriptor descriptor)
Definition: ScatterNd.cpp:41
NormalizationLayer.hpp
armnn::BatchMatMul
Definition: BatchMatMulImpl.hpp:16
armnn::Pad
void Pad(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const ITensorHandle *inputHandle, ITensorHandle *outputHandle, const PadQueueDescriptor &data)
Definition: Pad.cpp:39
DebugLayer.hpp
UnidirectionalSequenceLstmLayer.hpp
armnn::Debug
void Debug(const TensorInfo &inputInfo, const T *inputData, LayerGuid guid, const std::string &layerName, unsigned int slotIndex, bool outputsToFile)
Definition: Debug.cpp:97
armnn::Resize
void Resize(Decoder< float > &in, const TensorInfo &inputInfo, Encoder< float > &out, const TensorInfo &outputInfo, DataLayoutIndexed dataLayout, ResizeMethod resizeMethod, bool alignCorners, bool halfPixelCenters)
Definition: Resize.cpp:65
armnn::LayerEnumOf
constexpr LayerType LayerEnumOf(const T *=nullptr)
SwitchLayer.hpp
BroadcastToLayer.hpp
ScatterNdLayer.hpp
ElementwiseUnaryLayer.hpp
DequantizeLayer.hpp
MemImportLayer.hpp
ConstantLayer.hpp
OutputLayer.hpp
ConvertFp16ToFp32Layer.hpp
armnn::FakeQuantization
void FakeQuantization(const float *inputData, float *outputData, uint32_t numElements, float min, float max)
Definition: RefFakeQuantizationFloat32Workload.cpp:17
SpaceToBatchNdLayer.hpp
LogicalBinaryLayer.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
InputLayer.hpp
armnn::LayerTypeOf
typename LayerTypeOfImpl< Type >::Type LayerTypeOf
Definition: LayersFwd.hpp:95
armnn::DepthToSpace
void DepthToSpace(const TensorInfo &inputInfo, const DepthToSpaceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
Definition: DepthToSpace.cpp:16
MeanLayer.hpp
Pooling3dLayer.hpp
armnn::StridedSlice
void StridedSlice(const TensorInfo &inputInfo, const StridedSliceDescriptor &params, const void *inputData, void *outputData, unsigned int dataTypeSize)
Definition: StridedSlice.cpp:86
QuantizeLayer.hpp
InternalTypes.hpp
StridedSliceLayer.hpp
StackLayer.hpp
FloorLayer.hpp
L2NormalizationLayer.hpp
armnn::Activation
float Activation(float in, ActivationFunction function, float a, float b)
Definition: Activation.cpp:13
MultiplicationLayer.hpp
ConcatLayer.hpp
Pooling2dLayer.hpp
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:491
BatchToSpaceNdLayer.hpp
FakeQuantizationLayer.hpp
ConvertFp32ToFp16Layer.hpp
SplitterLayer.hpp
ReshapeLayer.hpp
armnn::Gather
void Gather(const TensorInfo &paramsInfo, const TensorInfo &indicesInfo, const TensorInfo &outputInfo, Decoder< float > &params, const int32_t *indices, Encoder< float > &output, const int32_t axis_int)
Definition: Gather.cpp:15
DepthwiseConvolution2dLayer.hpp
StandInLayer.hpp
armnn::DetectionPostProcess
void DetectionPostProcess(const TensorInfo &boxEncodingsInfo, const TensorInfo &scoresInfo, const TensorInfo &, const TensorInfo &detectionBoxesInfo, const TensorInfo &, const TensorInfo &, const TensorInfo &, const DetectionPostProcessDescriptor &desc, Decoder< float > &boxEncodings, Decoder< float > &scores, Decoder< float > &anchors, float *detectionBoxes, float *detectionClasses, float *detectionScores, float *numDetections)
Definition: DetectionPostProcess.cpp:139