ArmNN
 24.02
LayersFwd.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 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"
70 #include "layers/ShapeLayer.hpp"
71 #include "layers/SliceLayer.hpp"
72 #include "layers/SoftmaxLayer.hpp"
75 #include "layers/SplitterLayer.hpp"
76 #include "layers/StackLayer.hpp"
77 #include "layers/StandInLayer.hpp"
80 #include "layers/SwitchLayer.hpp"
81 #include "layers/TileLayer.hpp"
85 #include "layers/UnmapLayer.hpp"
86 
87 namespace armnn
88 {
89 
90 template <LayerType Type>
92 
93 template <LayerType Type>
95 
96 template <typename T>
97 constexpr LayerType LayerEnumOf(const T* = nullptr);
98 
99 #define DECLARE_LAYER_IMPL(_, LayerName) \
100  class LayerName##Layer; \
101  template <> \
102  struct LayerTypeOfImpl<LayerType::_##LayerName> \
103  { \
104  using Type = LayerName##Layer; \
105  }; \
106  template <> \
107  constexpr LayerType LayerEnumOf(const LayerName##Layer*) \
108  { \
109  return LayerType::_##LayerName; \
110  }
111 
112 #define DECLARE_LAYER(LayerName) DECLARE_LAYER_IMPL(, LayerName)
113 
115 DECLARE_LAYER(Addition)
118 DECLARE_LAYER(BatchNormalization)
120 DECLARE_LAYER(BroadcastTo)
122 DECLARE_LAYER(ChannelShuffle)
123 DECLARE_LAYER(Comparison)
125 DECLARE_LAYER(Constant)
126 DECLARE_LAYER(ConvertFp16ToFp32)
127 DECLARE_LAYER(ConvertFp32ToFp16)
128 DECLARE_LAYER(Convolution2d)
129 DECLARE_LAYER(Convolution3d)
132 DECLARE_LAYER(DepthwiseConvolution2d)
135 DECLARE_LAYER(Division)
136 DECLARE_LAYER(ElementwiseBinary)
137 DECLARE_LAYER(ElementwiseUnary)
144 DECLARE_LAYER(GatherNd)
146 DECLARE_LAYER(InstanceNormalization)
147 DECLARE_LAYER(L2Normalization)
148 DECLARE_LAYER(LogicalBinary)
155 DECLARE_LAYER(MemImport)
158 DECLARE_LAYER(Multiplication)
159 DECLARE_LAYER(Normalization)
165 DECLARE_LAYER(PreCompiled)
169 DECLARE_LAYER(QuantizedLstm)
184 DECLARE_LAYER(Subtraction)
188 DECLARE_LAYER(TransposeConvolution2d)
189 DECLARE_LAYER(UnidirectionalSequenceLstm)
191 }
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:112
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:29
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:15
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:91
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:52
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
armnn::DetectionPostProcess
void DetectionPostProcess(const TensorInfo &boxEncodingsInfo, const TensorInfo &scoresInfo, const TensorInfo &anchorsInfo, const TensorInfo &detectionBoxesInfo, const TensorInfo &detectionClassesInfo, const TensorInfo &detectionScoresInfo, const TensorInfo &numDetectionsInfo, const DetectionPostProcessDescriptor &desc, Decoder< float > &boxEncodings, Decoder< float > &scores, Decoder< float > &anchors, float *detectionBoxes, float *detectionClasses, float *detectionScores, float *numDetections)
Definition: DetectionPostProcess.cpp:141
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
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
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:94
armnn::DepthToSpace
void DepthToSpace(const TensorInfo &inputInfo, const DepthToSpaceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
Definition: DepthToSpace.cpp:18
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:90
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