24.02
|
#include <Layer.hpp>
#include <tosa_serialization_handler.h>
#include "operatorMappings/TosaCommonOperators.hpp"
Go to the source code of this file.
◆ GetTosaMapping()
Definition at line 18 of file TosaMappings.cpp.
28 auto activationDesc = PolymorphicDowncast<const ActivationDescriptor*>(&descriptor);
29 if (activationDesc->m_Function == ActivationFunction::LeakyReLu)
38 case LayerType::Addition:
39 case LayerType::Multiplication:
40 case LayerType::Subtraction:
44 case LayerType::ElementwiseBinary:
46 auto binaryDesc = PolymorphicDowncast<const ElementwiseBinaryDescriptor*>(&descriptor);
49 case LayerType::ElementwiseUnary:
51 auto unaryDesc = PolymorphicDowncast<const ElementwiseUnaryDescriptor*>(&descriptor);
54 case LayerType::Concat:
56 auto concatDesc = PolymorphicDowncast<const OriginsDescriptor*>(&descriptor);
59 case LayerType::Constant:
63 case LayerType::Convolution2d:
65 auto conv2dDesc = PolymorphicDowncast<const Convolution2dDescriptor*>(&descriptor);
70 auto poolDesc = PolymorphicDowncast<const Pooling2dDescriptor*>(&descriptor);
72 bool avgPoolIgnoreValue =
73 (poolDesc->m_PoolType == PoolingAlgorithm::Average) &&
74 (poolDesc->m_PaddingMethod == PaddingMethod::IgnoreValue);
76 if (poolDesc->m_PoolType == PoolingAlgorithm::L2)
80 else if (avgPoolIgnoreValue)
93 case LayerType::Reshape:
95 auto reshapeDesc = PolymorphicDowncast<const ReshapeDescriptor*>(&descriptor);
100 auto resizeDesc = PolymorphicDowncast<const ResizeDescriptor*>(&descriptor);
105 auto sliceDesc = PolymorphicDowncast<const SliceDescriptor*>(&descriptor);
110 auto splitDesc = PolymorphicDowncast<const SplitterDescriptor*>(&descriptor);
113 case LayerType::TransposeConvolution2d:
115 auto transposeConv2dDesc = PolymorphicDowncast<const TransposeConvolution2dDescriptor*>(&descriptor);
120 auto transposeDesc = PolymorphicDowncast<const TransposeDescriptor*>(&descriptor);
References armnn::Activation, armnn::Addition, armnn::Average, armnn::Concat, armnn::Constant, ConvertActivationToTosaOperator(), ConvertAvgPool2DIgnoreValueToTosaOperator(), ConvertConcatToTosaOperator(), ConvertConstantToTosaOperator(), ConvertConv2dToTosaOperator(), ConvertElementwiseBinaryToTosaOperator(), ConvertElementwiseUnaryOperator(), ConvertPooling2DToTosaOperator(), ConvertQuantizeToTosaOperator(), ConvertReshapeToTosaOperator(), ConvertResizeToTosaOperator(), ConvertSliceToTosaOperator(), ConvertSplitToTosaOperator(), ConvertTransposeConv2dToTosaOperator(), ConvertTransposeToTosaOperator(), armnn::Convolution2d, CreateEmptyTosaSerializationBasicBlock(), armnn::ElementwiseBinary, armnn::ElementwiseUnary, armnn::IgnoreValue, armnn::L2, armnn::LeakyReLu, armnn::Multiplication, armnn::Pooling2d, armnn::Quantize, armnn::Reshape, armnn::Resize, armnn::Slice, armnn::Splitter, armnn::Subtraction, armnn::Transpose, and armnn::TransposeConvolution2d.
Referenced by GetTosaMappingFromLayer(), and TosaRefLayerSupport::IsLayerSupported().
◆ GetTosaMappingFromLayer()
TosaSerializationBasicBlock* GetTosaMappingFromLayer |
( |
Layer * |
layer | ) |
|
void Transpose(const armnn::TensorShape &dstShape, const armnn::PermutationVector &mappings, const void *src, void *dst, size_t dataTypeSize)
TosaSerializationBasicBlock * CreateEmptyTosaSerializationBasicBlock()
TosaSerializationBasicBlock * ConvertReshapeToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ReshapeDescriptor *reshapeDescriptor)
void Splitter(const SplitterQueueDescriptor &data, std::vector< ITensorHandle * > inputs, std::vector< ITensorHandle * > outputs)
TosaSerializationBasicBlock * ConvertElementwiseBinaryToTosaOperator(const Layer *layer, const LayerType type, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ElementwiseBinaryDescriptor *descriptor)
void Pooling2d(Decoder< float > &rInputDecoder, Encoder< float > &rOutputEncoder, const TensorInfo &inputInfo, const TensorInfo &outputInfo, const Pooling2dDescriptor ¶ms)
Computes the Pooling2d operation.
TosaSerializationBasicBlock * ConvertAvgPool2DIgnoreValueToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const Pooling2dDescriptor *poolDescriptor)
TosaSerializationBasicBlock * ConvertConv2dToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const Convolution2dDescriptor *conv2dDescriptor)
TosaSerializationBasicBlock * ConvertPooling2DToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const Pooling2dDescriptor *poolDescriptor)
TosaSerializationBasicBlock * ConvertConcatToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const OriginsDescriptor *concatDescriptor)
const std::vector< InputSlot > & GetInputSlots() const
TosaSerializationBasicBlock * ConvertElementwiseUnaryOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ElementwiseUnaryDescriptor *unaryDescriptor)
TosaSerializationBasicBlock * ConvertConstantToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &outputs)
TosaSerializationBasicBlock * ConvertSplitToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const SplitterDescriptor *splitDescriptor)
void Slice(const TensorInfo &inputInfo, const SliceDescriptor &descriptor, const void *inputData, void *outputData, unsigned int dataTypeSize)
TosaSerializationBasicBlock * ConvertSliceToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const SliceDescriptor *sliceDescriptor)
const std::vector< OutputSlot > & GetOutputSlots() const
QuantizedType Quantize(float value, float scale, int32_t offset)
Quantize a floating point data type into an 8-bit data type.
TosaSerializationBasicBlock * GetTosaMapping(const Layer *layer, const LayerType type, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const BaseDescriptor &descriptor)
TosaSerializationBasicBlock * ConvertTransposeConv2dToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const TransposeConvolution2dDescriptor *descriptor)
virtual const BaseDescriptor & GetParameters() const override
If the layer has a descriptor return it.
TosaSerializationBasicBlock * ConvertQuantizeToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs)
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
void Resize(Decoder< float > &in, const TensorInfo &inputInfo, Encoder< float > &out, const TensorInfo &outputInfo, DataLayoutIndexed dataLayout, ResizeMethod resizeMethod, bool alignCorners, bool halfPixelCenters)
TosaSerializationBasicBlock * ConvertActivationToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ActivationDescriptor *activationDescriptor)
TosaSerializationBasicBlock * ConvertResizeToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ResizeDescriptor *resizeDescriptor)
TosaSerializationBasicBlock * ConvertTransposeToTosaOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const TransposeDescriptor *transposeDescriptor)
float Activation(float in, ActivationFunction function, float a, float b)