ArmNN
 20.08
SerializerVisitor Class Reference

#include <Serializer.hpp>

Inheritance diagram for SerializerVisitor:
ILayerVisitor

Public Member Functions

 SerializerVisitor ()
 
 ~SerializerVisitor ()
 
flatbuffers::FlatBufferBuilder & GetFlatBufferBuilder ()
 
std::vector< int > & GetInputIds ()
 
std::vector< int > & GetOutputIds ()
 
std::vector< flatbuffers::Offset< armnnSerializer::AnyLayer > > & GetSerializedLayers ()
 
flatbuffers::Offset< armnnSerializer::FeatureCompatibilityVersions > GetVersionTable ()
 
void VisitAbsLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function an absolute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitActivationLayer (const armnn::IConnectableLayer *layer, const armnn::ActivationDescriptor &descriptor, const char *name=nullptr) override
 Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitAdditionLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitArgMinMaxLayer (const armnn::IConnectableLayer *layer, const armnn::ArgMinMaxDescriptor &argMinMaxDescriptor, const char *name=nullptr) override
 Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchToSpaceNdLayer (const armnn::IConnectableLayer *layer, const armnn::BatchToSpaceNdDescriptor &descriptor, const char *name=nullptr) override
 Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitBatchNormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::BatchNormalizationDescriptor &BatchNormalizationDescriptor, const armnn::ConstTensor &mean, const armnn::ConstTensor &variance, const armnn::ConstTensor &beta, const armnn::ConstTensor &gamma, const char *name=nullptr) override
 Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitComparisonLayer (const armnn::IConnectableLayer *layer, const armnn::ComparisonDescriptor &descriptor, const char *name=nullptr) override
 Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConcatLayer (const armnn::IConnectableLayer *layer, const armnn::ConcatDescriptor &concatDescriptor, const char *name=nullptr) override
 Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConstantLayer (const armnn::IConnectableLayer *layer, const armnn::ConstTensor &input, const char *=nullptr) override
 Function a layer with no inputs and a single output, which always corresponds to the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitConvolution2dLayer (const armnn::IConnectableLayer *layer, const armnn::Convolution2dDescriptor &descriptor, const armnn::ConstTensor &weights, const armnn::Optional< armnn::ConstTensor > &biases, const char *=nullptr) override
 Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthToSpaceLayer (const armnn::IConnectableLayer *layer, const armnn::DepthToSpaceDescriptor &descriptor, const char *name=nullptr) override
 Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDepthwiseConvolution2dLayer (const armnn::IConnectableLayer *layer, const armnn::DepthwiseConvolution2dDescriptor &descriptor, const armnn::ConstTensor &weights, const armnn::Optional< armnn::ConstTensor > &biases, const char *name=nullptr) override
 Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDequantizeLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a Dequantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDetectionPostProcessLayer (const armnn::IConnectableLayer *layer, const armnn::DetectionPostProcessDescriptor &descriptor, const armnn::ConstTensor &anchors, const char *name=nullptr) override
 Function that a Detection PostProcess layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitDivisionLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitElementwiseUnaryLayer (const armnn::IConnectableLayer *layer, const armnn::ElementwiseUnaryDescriptor &descriptor, const char *name=nullptr) override
 Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitEqualLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFillLayer (const armnn::IConnectableLayer *layer, const armnn::FillDescriptor &fillDescriptor, const char *name=nullptr) override
 Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFloorLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitFullyConnectedLayer (const armnn::IConnectableLayer *layer, const armnn::FullyConnectedDescriptor &fullyConnectedDescriptor, const armnn::ConstTensor &weights, const armnn::Optional< armnn::ConstTensor > &biases, const char *name=nullptr) override
 Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGatherLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGatherLayer (const armnn::IConnectableLayer *layer, const armnn::GatherDescriptor &gatherDescriptor, const char *name=nullptr) override
 Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitGreaterLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInputLayer (const armnn::IConnectableLayer *layer, armnn::LayerBindingId id, const char *name=nullptr) override
 Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInstanceNormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::InstanceNormalizationDescriptor &instanceNormalizationDescriptor, const char *name=nullptr) override
 Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitL2NormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::L2NormalizationDescriptor &l2NormalizationDescriptor, const char *name=nullptr) override
 Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLogSoftmaxLayer (const armnn::IConnectableLayer *layer, const armnn::LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr) override
 Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLstmLayer (const armnn::IConnectableLayer *layer, const armnn::LstmDescriptor &descriptor, const armnn::LstmInputParams &params, const char *name=nullptr) override
 Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMeanLayer (const armnn::IConnectableLayer *layer, const armnn::MeanDescriptor &descriptor, const char *name) override
 Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMinimumLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMaximumLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergeLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergerLayer (const armnn::IConnectableLayer *layer, const armnn::MergerDescriptor &mergerDescriptor, const char *name=nullptr) override
 Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMultiplicationLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitOutputLayer (const armnn::IConnectableLayer *layer, armnn::LayerBindingId id, const char *name=nullptr) override
 Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPadLayer (const armnn::IConnectableLayer *layer, const armnn::PadDescriptor &PadDescriptor, const char *name=nullptr) override
 Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPermuteLayer (const armnn::IConnectableLayer *layer, const armnn::PermuteDescriptor &PermuteDescriptor, const char *name=nullptr) override
 Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPooling2dLayer (const armnn::IConnectableLayer *layer, const armnn::Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr) override
 Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPreluLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQuantizeLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQLstmLayer (const armnn::IConnectableLayer *layer, const armnn::QLstmDescriptor &descriptor, const armnn::LstmInputParams &params, const char *name=nullptr) override
 Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQuantizedLstmLayer (const armnn::IConnectableLayer *layer, const armnn::QuantizedLstmInputParams &params, const char *name=nullptr) override
 Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitRankLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitReshapeLayer (const armnn::IConnectableLayer *layer, const armnn::ReshapeDescriptor &reshapeDescriptor, const char *name=nullptr) override
 Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeLayer (const armnn::IConnectableLayer *layer, const armnn::ResizeDescriptor &resizeDescriptor, const char *name=nullptr) override
 Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitResizeBilinearLayer (const armnn::IConnectableLayer *layer, const armnn::ResizeBilinearDescriptor &resizeDescriptor, const char *name=nullptr) override
 Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitRsqrtLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSliceLayer (const armnn::IConnectableLayer *layer, const armnn::SliceDescriptor &sliceDescriptor, const char *name=nullptr) override
 Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSoftmaxLayer (const armnn::IConnectableLayer *layer, const armnn::SoftmaxDescriptor &softmaxDescriptor, const char *name=nullptr) override
 Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToBatchNdLayer (const armnn::IConnectableLayer *layer, const armnn::SpaceToBatchNdDescriptor &spaceToBatchNdDescriptor, const char *name=nullptr) override
 Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSpaceToDepthLayer (const armnn::IConnectableLayer *layer, const armnn::SpaceToDepthDescriptor &spaceToDepthDescriptor, const char *name=nullptr) override
 Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitNormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::NormalizationDescriptor &normalizationDescriptor, const char *name=nullptr) override
 Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSplitterLayer (const armnn::IConnectableLayer *layer, const armnn::ViewsDescriptor &viewsDescriptor, const char *name=nullptr) override
 Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStandInLayer (const armnn::IConnectableLayer *layer, const armnn::StandInDescriptor &standInDescriptor, const char *name=nullptr) override
 Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked. More...
 
void VisitStackLayer (const armnn::IConnectableLayer *layer, const armnn::StackDescriptor &stackDescriptor, const char *name=nullptr) override
 Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitStridedSliceLayer (const armnn::IConnectableLayer *layer, const armnn::StridedSliceDescriptor &stridedSliceDescriptor, const char *name=nullptr) override
 Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSubtractionLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitSwitchLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeConvolution2dLayer (const armnn::IConnectableLayer *layer, const armnn::TransposeConvolution2dDescriptor &descriptor, const armnn::ConstTensor &weights, const armnn::Optional< armnn::ConstTensor > &biases, const char *=nullptr) override
 Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitTransposeLayer (const armnn::IConnectableLayer *layer, const armnn::TransposeDescriptor &descriptor, const char *name=nullptr) override
 Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
- Public Member Functions inherited from ILayerVisitor
virtual void StartVisit ()
 
virtual void FinishVisit ()
 

Additional Inherited Members

- Protected Member Functions inherited from ILayerVisitor
 ILayerVisitor ()
 
virtual ~ILayerVisitor ()
 

Detailed Description

Definition at line 21 of file Serializer.hpp.

Constructor & Destructor Documentation

◆ SerializerVisitor()

SerializerVisitor ( )
inline

Definition at line 24 of file Serializer.hpp.

24 : m_layerId(0) {}

◆ ~SerializerVisitor()

~SerializerVisitor ( )
inline

Definition at line 25 of file Serializer.hpp.

25 {}

Member Function Documentation

◆ GetFlatBufferBuilder()

flatbuffers::FlatBufferBuilder& GetFlatBufferBuilder ( )
inline

Definition at line 27 of file Serializer.hpp.

28  {
29  return m_flatBufferBuilder;
30  }

◆ GetInputIds()

std::vector<int>& GetInputIds ( )
inline

Definition at line 32 of file Serializer.hpp.

33  {
34  return m_inputIds;
35  }

◆ GetOutputIds()

std::vector<int>& GetOutputIds ( )
inline

Definition at line 37 of file Serializer.hpp.

38  {
39  return m_outputIds;
40  }

◆ GetSerializedLayers()

std::vector<flatbuffers::Offset<armnnSerializer::AnyLayer> >& GetSerializedLayers ( )
inline

Definition at line 42 of file Serializer.hpp.

References anchors(), ARMNN_DEPRECATED_MSG, SerializerVisitor::GetVersionTable(), SerializerVisitor::VisitAbsLayer(), SerializerVisitor::VisitActivationLayer(), SerializerVisitor::VisitAdditionLayer(), SerializerVisitor::VisitArgMinMaxLayer(), SerializerVisitor::VisitBatchNormalizationLayer(), SerializerVisitor::VisitBatchToSpaceNdLayer(), SerializerVisitor::VisitComparisonLayer(), SerializerVisitor::VisitConcatLayer(), SerializerVisitor::VisitConstantLayer(), SerializerVisitor::VisitConvolution2dLayer(), SerializerVisitor::VisitDepthToSpaceLayer(), SerializerVisitor::VisitDepthwiseConvolution2dLayer(), SerializerVisitor::VisitDequantizeLayer(), SerializerVisitor::VisitDetectionPostProcessLayer(), SerializerVisitor::VisitDivisionLayer(), SerializerVisitor::VisitElementwiseUnaryLayer(), SerializerVisitor::VisitEqualLayer(), SerializerVisitor::VisitFillLayer(), SerializerVisitor::VisitFloorLayer(), SerializerVisitor::VisitFullyConnectedLayer(), SerializerVisitor::VisitGatherLayer(), SerializerVisitor::VisitGreaterLayer(), SerializerVisitor::VisitInputLayer(), SerializerVisitor::VisitInstanceNormalizationLayer(), SerializerVisitor::VisitL2NormalizationLayer(), SerializerVisitor::VisitLogSoftmaxLayer(), SerializerVisitor::VisitLstmLayer(), SerializerVisitor::VisitMaximumLayer(), SerializerVisitor::VisitMeanLayer(), SerializerVisitor::VisitMergeLayer(), SerializerVisitor::VisitMergerLayer(), SerializerVisitor::VisitMinimumLayer(), SerializerVisitor::VisitMultiplicationLayer(), SerializerVisitor::VisitNormalizationLayer(), SerializerVisitor::VisitOutputLayer(), SerializerVisitor::VisitPadLayer(), SerializerVisitor::VisitPermuteLayer(), SerializerVisitor::VisitPooling2dLayer(), SerializerVisitor::VisitPreluLayer(), SerializerVisitor::VisitQLstmLayer(), SerializerVisitor::VisitQuantizedLstmLayer(), SerializerVisitor::VisitQuantizeLayer(), SerializerVisitor::VisitRankLayer(), SerializerVisitor::VisitReshapeLayer(), SerializerVisitor::VisitResizeBilinearLayer(), SerializerVisitor::VisitResizeLayer(), SerializerVisitor::VisitRsqrtLayer(), SerializerVisitor::VisitSliceLayer(), SerializerVisitor::VisitSoftmaxLayer(), SerializerVisitor::VisitSpaceToBatchNdLayer(), SerializerVisitor::VisitSpaceToDepthLayer(), SerializerVisitor::VisitSplitterLayer(), SerializerVisitor::VisitStackLayer(), SerializerVisitor::VisitStandInLayer(), SerializerVisitor::VisitStridedSliceLayer(), SerializerVisitor::VisitSubtractionLayer(), SerializerVisitor::VisitSwitchLayer(), SerializerVisitor::VisitTransposeConvolution2dLayer(), and SerializerVisitor::VisitTransposeLayer().

43  {
44  return m_serializedLayers;
45  }

◆ GetVersionTable()

flatbuffers::Offset< armnnSerializer::FeatureCompatibilityVersions > GetVersionTable ( )

Definition at line 1666 of file Serializer.cpp.

References IOutputSlot::CalculateIndexOnOwner(), IInputSlot::GetConnection(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetNumInputSlots(), IConnectableLayer::GetNumOutputSlots(), IConnectableLayer::GetOutputSlot(), IOutputSlot::GetOwningLayerGuid(), and IOutputSlot::GetTensorInfo().

Referenced by SerializerVisitor::GetSerializedLayers().

1667 {
1668  flatbuffers::Offset<armnnSerializer::FeatureCompatibilityVersions> versionsTable =
1669  serializer::CreateFeatureCompatibilityVersions(
1670  m_flatBufferBuilder,
1671  1 // Binding ids scheme version
1672  );
1673  return versionsTable;
1674 }

◆ VisitAbsLayer()

void VisitAbsLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function an absolute layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 128 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

129 {
130  IgnoreUnused(name);
131  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Abs);
132  auto flatBufferAbsLayer = serializer::CreateAbsLayer(m_flatBufferBuilder, flatBufferBaseLayer);
133 
134  CreateAnyLayer(flatBufferAbsLayer.o, serializer::Layer::Layer_AbsLayer);
135 }
void IgnoreUnused(Ts &&...)

◆ VisitActivationLayer()

void VisitActivationLayer ( const armnn::IConnectableLayer layer,
const armnn::ActivationDescriptor activationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that an activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
activationDescriptor- ActivationDescriptor to configure the activation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 138 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferActivationFunction(), armnn::IgnoreUnused(), ActivationDescriptor::m_A, ActivationDescriptor::m_B, and ActivationDescriptor::m_Function.

Referenced by SerializerVisitor::GetSerializedLayers().

141 {
142  IgnoreUnused(name);
143 
144  // Create FlatBuffer BaseLayer
145  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Activation);
146 
147  // Create the FlatBuffer ActivationDescriptor
148  auto flatBufferDescriptor = CreateActivationDescriptor(m_flatBufferBuilder,
149  GetFlatBufferActivationFunction(descriptor.m_Function),
150  descriptor.m_A,
151  descriptor.m_B);
152 
153  // Create the FlatBuffer ActivationLayer
154  auto flatBufferAdditionLayer = CreateActivationLayer(m_flatBufferBuilder,
155  flatBufferBaseLayer,
156  flatBufferDescriptor);
157 
158  // Add the AnyLayer to the FlatBufferLayers
159  CreateAnyLayer(flatBufferAdditionLayer.o, serializer::Layer::Layer_ActivationLayer);
160 }
serializer::ActivationFunction GetFlatBufferActivationFunction(armnn::ActivationFunction function)
Definition: Serializer.cpp:26
void IgnoreUnused(Ts &&...)

◆ VisitAdditionLayer()

void VisitAdditionLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that an addition layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 163 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

164 {
165  IgnoreUnused(name);
166 
167  // Create FlatBuffer BaseLayer
168  auto flatBufferAdditionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Addition);
169 
170  // Create the FlatBuffer AdditionLayer
171  auto flatBufferAdditionLayer = serializer::CreateAdditionLayer(m_flatBufferBuilder, flatBufferAdditionBaseLayer);
172 
173  // Add the AnyLayer to the FlatBufferLayers
174  CreateAnyLayer(flatBufferAdditionLayer.o, serializer::Layer::Layer_AdditionLayer);
175 }
void IgnoreUnused(Ts &&...)

◆ VisitArgMinMaxLayer()

void VisitArgMinMaxLayer ( const armnn::IConnectableLayer layer,
const armnn::ArgMinMaxDescriptor argMinMaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that an arg min max layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
argMinMaxDescriptor- ArgMinMaxDescriptor to configure the activation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 178 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferArgMinMaxFunction(), armnn::IgnoreUnused(), ArgMinMaxDescriptor::m_Axis, and ArgMinMaxDescriptor::m_Function.

Referenced by SerializerVisitor::GetSerializedLayers().

181 {
182  IgnoreUnused(name);
183 
184  // Create FlatBuffer BaseLayer
185  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ArgMinMax);
186 
187  // Create FlatBuffer Descriptor
188  auto flatBufferDescriptor = CreateArgMinMaxDescriptor(m_flatBufferBuilder,
189  GetFlatBufferArgMinMaxFunction(descriptor.m_Function),
190  descriptor.m_Axis);
191 
192  // Create FlatBuffer ArgMinMaxLayer
193  auto flatBufferLayer = CreateArgMinMaxLayer(m_flatBufferBuilder,
194  flatBufferBaseLayer,
195  flatBufferDescriptor);
196 
197  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ArgMinMaxLayer);
198 }
void IgnoreUnused(Ts &&...)
serializer::ArgMinMaxFunction GetFlatBufferArgMinMaxFunction(armnn::ArgMinMaxFunction function)
Definition: Serializer.cpp:57

◆ VisitBatchNormalizationLayer()

void VisitBatchNormalizationLayer ( const armnn::IConnectableLayer layer,
const armnn::BatchNormalizationDescriptor desc,
const armnn::ConstTensor mean,
const armnn::ConstTensor variance,
const armnn::ConstTensor beta,
const armnn::ConstTensor gamma,
const char *  name = nullptr 
)
overridevirtual

Function that a batch normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
mean- Pre-calculated mean for each channel.
variance- Pre-calculated variance for each channel.
beta- Per-channel additive factor.
gamma- Per-channel multiplicative factor.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 231 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), BatchNormalizationDescriptor::m_DataLayout, and BatchNormalizationDescriptor::m_Eps.

Referenced by SerializerVisitor::GetSerializedLayers().

238 {
239  IgnoreUnused(name);
240 
241  auto fbBatchNormalizationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_BatchNormalization);
242  auto fbBatchNormalizationDescriptor = serializer::CreateBatchNormalizationDescriptor(
243  m_flatBufferBuilder,
244  batchNormDescriptor.m_Eps,
245  GetFlatBufferDataLayout(batchNormDescriptor.m_DataLayout));
246 
247  auto fbMeanConstTensorInfo = CreateConstTensorInfo(mean);
248  auto fbVarianceConstTensorInfo = CreateConstTensorInfo(variance);
249  auto fbBetaConstTensorInfo = CreateConstTensorInfo(beta);
250  auto fbGammaConstTensorInfo = CreateConstTensorInfo(gamma);
251  auto fbBatchNormalizationLayer = serializer::CreateBatchNormalizationLayer(m_flatBufferBuilder,
252  fbBatchNormalizationBaseLayer,
253  fbBatchNormalizationDescriptor,
254  fbMeanConstTensorInfo,
255  fbVarianceConstTensorInfo,
256  fbBetaConstTensorInfo,
257  fbGammaConstTensorInfo);
258 
259  CreateAnyLayer(fbBatchNormalizationLayer.o, serializer::Layer::Layer_BatchNormalizationLayer);
260 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitBatchToSpaceNdLayer()

void VisitBatchToSpaceNdLayer ( const armnn::IConnectableLayer layer,
const armnn::BatchToSpaceNdDescriptor batchToSpaceNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a batch to space ND layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
batchToSpaceNdDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 201 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), BatchToSpaceNdDescriptor::m_BlockShape, BatchToSpaceNdDescriptor::m_Crops, and BatchToSpaceNdDescriptor::m_DataLayout.

Referenced by SerializerVisitor::GetSerializedLayers().

204 {
205  IgnoreUnused(name);
206 
207  // Create FlatBuffer BaseLayer
208  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_BatchToSpaceNd);
209 
210  std::vector<unsigned int> crops;
211  crops.reserve(descriptor.m_Crops.size() * 2);
212  for (auto& crop : descriptor.m_Crops)
213  {
214  crops.push_back(crop.first);
215  crops.push_back(crop.second);
216  }
217 
218  auto flatBufferDescriptor =
219  CreateBatchToSpaceNdDescriptor(m_flatBufferBuilder,
220  m_flatBufferBuilder.CreateVector(descriptor.m_BlockShape),
221  m_flatBufferBuilder.CreateVector(crops),
222  GetFlatBufferDataLayout(descriptor.m_DataLayout));
223 
224  auto flatBufferLayer = serializer::CreateBatchToSpaceNdLayer(m_flatBufferBuilder,
225  flatBufferBaseLayer,
226  flatBufferDescriptor);
227 
228  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_BatchToSpaceNdLayer);
229 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitComparisonLayer()

void VisitComparisonLayer ( const armnn::IConnectableLayer layer,
const armnn::ComparisonDescriptor comparisonDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a Comparison layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
comparisonDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 262 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferComparisonOperation(), armnn::IgnoreUnused(), and ComparisonDescriptor::m_Operation.

Referenced by SerializerVisitor::GetSerializedLayers().

265 {
266  IgnoreUnused(name);
267 
268  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Comparison);
269  auto fbDescriptor = serializer::CreateComparisonDescriptor(
270  m_flatBufferBuilder,
271  GetFlatBufferComparisonOperation(descriptor.m_Operation));
272 
273  auto fbLayer = serializer::CreateComparisonLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
274  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_ComparisonLayer);
275 }
void IgnoreUnused(Ts &&...)
armnnSerializer::ComparisonOperation GetFlatBufferComparisonOperation(armnn::ComparisonOperation comparisonOperation)

◆ VisitConcatLayer()

void VisitConcatLayer ( const armnn::IConnectableLayer layer,
const armnn::ConcatDescriptor concatDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
concatDescriptor- ConcatDescriptor (synonym for OriginsDescriptor) to configure the concatenation process. Number of Views must be equal to the number of inputs, and their order must match - e.g. first view corresponds to the first input, second view to the second input, etc....
name- Optional name for the layer.

Reimplemented from ILayerVisitor.

Definition at line 754 of file Serializer.cpp.

References OriginsDescriptor::GetConcatAxis(), OriginsDescriptor::GetNumDimensions(), OriginsDescriptor::GetNumViews(), OriginsDescriptor::GetViewOrigin(), and armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

757 {
758  IgnoreUnused(name);
759 
760  auto flatBufferConcatBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Concat);
761 
762  std::vector<flatbuffers::Offset<UintVector>> views;
763  for (unsigned int v = 0; v < concatDescriptor.GetNumViews(); ++v)
764  {
765  const uint32_t* origin = concatDescriptor.GetViewOrigin(v);
766  std::vector<uint32_t> origins;
767  for (unsigned int d = 0; d < concatDescriptor.GetNumDimensions(); ++d)
768  {
769  origins.push_back(origin[d]);
770  }
771  auto view = m_flatBufferBuilder.CreateVector(origins);
772  auto uintVector = CreateUintVector(m_flatBufferBuilder, view);
773  views.push_back(uintVector);
774  }
775 
776  auto flatBufferConcatDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
777  concatDescriptor.GetConcatAxis(),
778  concatDescriptor.GetNumViews(),
779  concatDescriptor.GetNumDimensions(),
780  m_flatBufferBuilder.CreateVector(views));
781 
782  auto flatBufferLayer = CreateConcatLayer(m_flatBufferBuilder,
783  flatBufferConcatBaseLayer,
784  flatBufferConcatDescriptor);
785 
786  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ConcatLayer);
787 }
void IgnoreUnused(Ts &&...)
const uint32_t * GetViewOrigin(uint32_t idx) const
Return the view origin at the int value idx.
uint32_t GetNumDimensions() const
Get the number of dimensions.
uint32_t GetNumViews() const
Get the number of views.
unsigned int GetConcatAxis() const
Get the concatenation axis value.

◆ VisitConstantLayer()

void VisitConstantLayer ( const armnn::IConnectableLayer layer,
const armnn::ConstTensor input,
const char *  name = nullptr 
)
overridevirtual

Function a layer with no inputs and a single output, which always corresponds to the passed in constant tensor should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
input- Tensor to be provided as the only output of the layer. The layer will maintain its own copy of the tensor data, meaning the memory referenced by input can be freed or reused after this function is called.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 278 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

281 {
282  IgnoreUnused(name);
283 
284  // Create FlatBuffer BaseLayer
285  auto flatBufferConstantBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Constant);
286 
287  auto flatBufferConstTensorInfo = CreateConstTensorInfo(input);
288 
289  // Create the FlatBuffer ConstantLayer
290  auto flatBufferLayer = CreateConstantLayer(m_flatBufferBuilder,
291  flatBufferConstantBaseLayer,
292  flatBufferConstTensorInfo);
293 
294  // Add the AnyLayer to the FlatBufferLayers
295  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ConstantLayer);
296 }
void IgnoreUnused(Ts &&...)

◆ VisitConvolution2dLayer()

void VisitConvolution2dLayer ( const armnn::IConnectableLayer layer,
const armnn::Convolution2dDescriptor convolution2dDescriptor,
const armnn::ConstTensor weights,
const armnn::Optional< armnn::ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
convolution2dDescriptor- Description of the 2D convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 299 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), OptionalBase::has_value(), armnn::IgnoreUnused(), Convolution2dDescriptor::m_BiasEnabled, Convolution2dDescriptor::m_DataLayout, Convolution2dDescriptor::m_DilationX, Convolution2dDescriptor::m_DilationY, Convolution2dDescriptor::m_PadBottom, Convolution2dDescriptor::m_PadLeft, Convolution2dDescriptor::m_PadRight, Convolution2dDescriptor::m_PadTop, Convolution2dDescriptor::m_StrideX, Convolution2dDescriptor::m_StrideY, and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by SerializerVisitor::GetSerializedLayers().

304 {
305  IgnoreUnused(name);
306 
307  // Create FlatBuffer BaseLayer
308  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Convolution2d);
309 
310  auto flatBufferDescriptor = CreateConvolution2dDescriptor(m_flatBufferBuilder,
311  descriptor.m_PadLeft,
312  descriptor.m_PadRight,
313  descriptor.m_PadTop,
314  descriptor.m_PadBottom,
315  descriptor.m_StrideX,
316  descriptor.m_StrideY,
317  descriptor.m_DilationX,
318  descriptor.m_DilationY,
319  descriptor.m_BiasEnabled,
320  GetFlatBufferDataLayout(descriptor.m_DataLayout));
321  auto flatBufferWeightsConstTensorInfo = CreateConstTensorInfo(weights);
322  flatbuffers::Offset<serializer::ConstTensor> flatBufferBiasesConstTensorInfo;
323 
324  if (biases.has_value())
325  {
326  flatBufferBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
327  }
328 
329  // Create the FlatBuffer Convolution2dLayer
330  auto flatBufferLayer = CreateConvolution2dLayer(m_flatBufferBuilder,
331  flatBufferBaseLayer,
332  flatBufferDescriptor,
333  flatBufferWeightsConstTensorInfo,
334  flatBufferBiasesConstTensorInfo);
335 
336  // Add the AnyLayer to the FlatBufferLayers
337  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_Convolution2dLayer);
338 }
void IgnoreUnused(Ts &&...)
bool has_value() const noexcept
Definition: Optional.hpp:53
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitDepthToSpaceLayer()

void VisitDepthToSpaceLayer ( const armnn::IConnectableLayer layer,
const armnn::DepthToSpaceDescriptor depthToSpaceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
depthToSpaceDescriptor- Parameters for the depth to space operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 340 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), SpaceToDepthDescriptor::m_BlockSize, and SpaceToDepthDescriptor::m_DataLayout.

Referenced by SerializerVisitor::GetSerializedLayers().

343 {
344  IgnoreUnused(name);
345 
346  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DepthToSpace);
347  auto fbDescriptor = CreateDepthToSpaceDescriptor(m_flatBufferBuilder,
348  descriptor.m_BlockSize,
349  GetFlatBufferDataLayout(descriptor.m_DataLayout));
350 
351  auto fbLayer = serializer::CreateDepthToSpaceLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
352 
353  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_DepthToSpaceLayer);
354 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitDepthwiseConvolution2dLayer()

void VisitDepthwiseConvolution2dLayer ( const armnn::IConnectableLayer layer,
const armnn::DepthwiseConvolution2dDescriptor convolution2dDescriptor,
const armnn::ConstTensor weights,
const armnn::Optional< armnn::ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D depthwise convolution layer with biases should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
convolution2dDescriptor- Description of the 2D depthwise convolution layer.
weights- Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
biases- Optional tensor for the bias data. If specified, must match the output tensor shape.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 356 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), OptionalBase::has_value(), armnn::IgnoreUnused(), DepthwiseConvolution2dDescriptor::m_BiasEnabled, DepthwiseConvolution2dDescriptor::m_DataLayout, DepthwiseConvolution2dDescriptor::m_DilationX, DepthwiseConvolution2dDescriptor::m_DilationY, DepthwiseConvolution2dDescriptor::m_PadBottom, DepthwiseConvolution2dDescriptor::m_PadLeft, DepthwiseConvolution2dDescriptor::m_PadRight, DepthwiseConvolution2dDescriptor::m_PadTop, DepthwiseConvolution2dDescriptor::m_StrideX, DepthwiseConvolution2dDescriptor::m_StrideY, and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by SerializerVisitor::GetSerializedLayers().

361 {
362  IgnoreUnused(name);
363 
364  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DepthwiseConvolution2d);
365  auto fbDescriptor = CreateDepthwiseConvolution2dDescriptor(m_flatBufferBuilder,
366  descriptor.m_PadLeft,
367  descriptor.m_PadRight,
368  descriptor.m_PadTop,
369  descriptor.m_PadBottom,
370  descriptor.m_StrideX,
371  descriptor.m_StrideY,
372  descriptor.m_DilationX,
373  descriptor.m_DilationY,
374  descriptor.m_BiasEnabled,
375  GetFlatBufferDataLayout(descriptor.m_DataLayout));
376 
377  flatbuffers::Offset<serializer::ConstTensor> fbWeightsConstTensorInfo = CreateConstTensorInfo(weights);
378  flatbuffers::Offset<serializer::ConstTensor> fbBiasesConstTensorInfo;
379  if (biases.has_value())
380  {
381  fbBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
382  }
383 
384  auto flatBufferLayer = CreateDepthwiseConvolution2dLayer(m_flatBufferBuilder,
385  fbBaseLayer,
386  fbDescriptor,
387  fbWeightsConstTensorInfo,
388  fbBiasesConstTensorInfo);
389 
390  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_DepthwiseConvolution2dLayer);
391 }
void IgnoreUnused(Ts &&...)
bool has_value() const noexcept
Definition: Optional.hpp:53
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitDequantizeLayer()

void VisitDequantizeLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a Dequantize layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 393 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

395 {
396  IgnoreUnused(name);
397 
398  auto fbDequantizeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Dequantize);
399  auto fbDequantizeLayer = serializer::CreateDequantizeLayer(m_flatBufferBuilder, fbDequantizeBaseLayer);
400 
401  CreateAnyLayer(fbDequantizeLayer.o, serializer::Layer::Layer_DequantizeLayer);
402 }
void IgnoreUnused(Ts &&...)

◆ VisitDetectionPostProcessLayer()

void VisitDetectionPostProcessLayer ( const armnn::IConnectableLayer layer,
const armnn::DetectionPostProcessDescriptor descriptor,
const armnn::ConstTensor anchors,
const char *  name = nullptr 
)
overridevirtual

Function that a Detection PostProcess layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
descriptor- Description of the Detection PostProcess layer.
anchors- Tensor for the anchors.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 404 of file Serializer.cpp.

References armnn::IgnoreUnused(), DetectionPostProcessDescriptor::m_DetectionsPerClass, DetectionPostProcessDescriptor::m_MaxClassesPerDetection, DetectionPostProcessDescriptor::m_MaxDetections, DetectionPostProcessDescriptor::m_NmsIouThreshold, DetectionPostProcessDescriptor::m_NmsScoreThreshold, DetectionPostProcessDescriptor::m_NumClasses, DetectionPostProcessDescriptor::m_ScaleH, DetectionPostProcessDescriptor::m_ScaleW, DetectionPostProcessDescriptor::m_ScaleX, DetectionPostProcessDescriptor::m_ScaleY, and DetectionPostProcessDescriptor::m_UseRegularNms.

Referenced by SerializerVisitor::GetSerializedLayers().

408 {
409  IgnoreUnused(name);
410 
411  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DetectionPostProcess);
412  auto fbDescriptor = CreateDetectionPostProcessDescriptor(m_flatBufferBuilder,
413  descriptor.m_MaxDetections,
414  descriptor.m_MaxClassesPerDetection,
415  descriptor.m_DetectionsPerClass,
416  descriptor.m_NmsScoreThreshold,
417  descriptor.m_NmsIouThreshold,
418  descriptor.m_NumClasses,
419  descriptor.m_UseRegularNms,
420  descriptor.m_ScaleX,
421  descriptor.m_ScaleY,
422  descriptor.m_ScaleW,
423  descriptor.m_ScaleH);
424 
425  flatbuffers::Offset<serializer::ConstTensor> fbAnchorsConstTensorInfo = CreateConstTensorInfo(anchors);
426 
427  auto flatBufferLayer = CreateDetectionPostProcessLayer(m_flatBufferBuilder,
428  fbBaseLayer,
429  fbDescriptor,
430  fbAnchorsConstTensorInfo);
431 
432  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_DetectionPostProcessLayer);
433 }
float m_ScaleW
Center size encoding scale weight.
float m_ScaleX
Center size encoding scale x.
uint32_t m_DetectionsPerClass
Detections per classes, used in Regular NMS.
void IgnoreUnused(Ts &&...)
uint32_t m_MaxClassesPerDetection
Maximum numbers of classes per detection, used in Fast NMS.
uint32_t m_MaxDetections
Maximum numbers of detections.
float m_NmsIouThreshold
Intersection over union threshold.
uint32_t m_NumClasses
Number of classes.
bool m_UseRegularNms
Use Regular NMS.
float m_ScaleH
Center size encoding scale height.
float m_ScaleY
Center size encoding scale y.
float m_NmsScoreThreshold
NMS score threshold.

◆ VisitDivisionLayer()

void VisitDivisionLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a division layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 435 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

436 {
437  IgnoreUnused(name);
438 
439  auto fbDivisionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Division);
440  auto fbDivisionLayer = serializer::CreateDivisionLayer(m_flatBufferBuilder, fbDivisionBaseLayer);
441 
442  CreateAnyLayer(fbDivisionLayer.o, serializer::Layer::Layer_DivisionLayer);
443 }
void IgnoreUnused(Ts &&...)

◆ VisitElementwiseUnaryLayer()

void VisitElementwiseUnaryLayer ( const armnn::IConnectableLayer layer,
const armnn::ElementwiseUnaryDescriptor elementwiseUnaryDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a ElementwiseUnary layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
elementwiseUnaryDescriptor- Description of the layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 445 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferUnaryOperation(), armnn::IgnoreUnused(), and ElementwiseUnaryDescriptor::m_Operation.

Referenced by SerializerVisitor::GetSerializedLayers().

448 {
449  IgnoreUnused(name);
450 
451  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ElementwiseUnary);
452  auto fbDescriptor = serializer::CreateElementwiseUnaryDescriptor(
453  m_flatBufferBuilder,
454  GetFlatBufferUnaryOperation(descriptor.m_Operation));
455 
456  auto fbLayer = serializer::CreateElementwiseUnaryLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
457  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_ElementwiseUnaryLayer);
458 }
armnnSerializer::UnaryOperation GetFlatBufferUnaryOperation(armnn::UnaryOperation comparisonOperation)
void IgnoreUnused(Ts &&...)

◆ VisitEqualLayer()

void VisitEqualLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function an Equal layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 460 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

461 {
462  IgnoreUnused(name);
463 
464  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Equal);
465  auto fbEqualLayer = serializer::CreateEqualLayer(m_flatBufferBuilder, fbBaseLayer);
466 
467  CreateAnyLayer(fbEqualLayer.o, serializer::Layer::Layer_EqualLayer);
468 }
void IgnoreUnused(Ts &&...)

◆ VisitFillLayer()

void VisitFillLayer ( const armnn::IConnectableLayer layer,
const armnn::FillDescriptor fillDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a fill layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
fillDescriptor- Description of the layer
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 470 of file Serializer.cpp.

References armnn::IgnoreUnused(), and FillDescriptor::m_Value.

Referenced by SerializerVisitor::GetSerializedLayers().

473 {
474  IgnoreUnused(name);
475 
476  auto fbFillBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Fill);
477 
478  auto fbDescriptor = serializer::CreateFillDescriptor(m_flatBufferBuilder, fillDescriptor.m_Value);
479 
480  auto fbFillLayer = serializer::CreateFillLayer(m_flatBufferBuilder, fbFillBaseLayer, fbDescriptor);
481 
482  CreateAnyLayer(fbFillLayer.o, serializer::Layer::Layer_FillLayer);
483 }
void IgnoreUnused(Ts &&...)

◆ VisitFloorLayer()

void VisitFloorLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a floor layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 485 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

486 {
487  IgnoreUnused(name);
488 
489  auto flatBufferFloorBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Floor);
490  auto flatBufferFloorLayer = serializer::CreateFloorLayer(m_flatBufferBuilder, flatBufferFloorBaseLayer);
491 
492  CreateAnyLayer(flatBufferFloorLayer.o, serializer::Layer::Layer_FloorLayer);
493 }
void IgnoreUnused(Ts &&...)

◆ VisitFullyConnectedLayer()

void VisitFullyConnectedLayer ( const armnn::IConnectableLayer layer,
const armnn::FullyConnectedDescriptor fullyConnectedDescriptor,
const armnn::ConstTensor weights,
const armnn::Optional< armnn::ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a fully connected layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
fullyConnectedDescriptor- Description of the fully connected layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1041 of file Serializer.cpp.

References armnn::IgnoreUnused(), FullyConnectedDescriptor::m_BiasEnabled, FullyConnectedDescriptor::m_TransposeWeightMatrix, and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by SerializerVisitor::GetSerializedLayers().

1046 {
1047  IgnoreUnused(name);
1048 
1049  // Create FlatBuffer BaseLayer
1050  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_FullyConnected);
1051 
1052  // Create FlatBuffer FullyConnectedDescriptor
1053  auto flatBufferDescriptor =
1054  serializer::CreateFullyConnectedDescriptor(m_flatBufferBuilder,
1055  fullyConnectedDescriptor.m_BiasEnabled,
1056  fullyConnectedDescriptor.m_TransposeWeightMatrix);
1057 
1058  // Create FlatBuffer weights data
1059  auto flatBufferWeights = CreateConstTensorInfo(weights);
1060 
1061  // Create FlatBuffer bias data
1062  flatbuffers::Offset<serializer::ConstTensor> flatBufferBiases;
1063  if (fullyConnectedDescriptor.m_BiasEnabled)
1064  {
1065  flatBufferBiases = CreateConstTensorInfo(biases.value());
1066  }
1067 
1068  // Create FlatBuffer FullyConnectedLayer
1069  auto flatBufferLayer = serializer::CreateFullyConnectedLayer(m_flatBufferBuilder,
1070  flatBufferBaseLayer,
1071  flatBufferDescriptor,
1072  flatBufferWeights,
1073  flatBufferBiases);
1074 
1075  // Add created FullyConnectedLayer to the FlatBufferLayers
1076  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_FullyConnectedLayer);
1077 }
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
void IgnoreUnused(Ts &&...)
bool m_BiasEnabled
Enable/disable bias.

◆ VisitGatherLayer() [1/2]

void VisitGatherLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 495 of file Serializer.cpp.

Referenced by SerializerVisitor::GetSerializedLayers().

497 {
498  armnn::GatherDescriptor gatherDescriptor{};
499  VisitGatherLayer(layer, gatherDescriptor, name);
500 }
void VisitGatherLayer(const armnn::IConnectableLayer *layer, const char *name=nullptr) override
Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked...
Definition: Serializer.cpp:495
A GatherDescriptor for the GatherLayer.

◆ VisitGatherLayer() [2/2]

void VisitGatherLayer ( const armnn::IConnectableLayer layer,
const armnn::GatherDescriptor gatherDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a Gather layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
gatherDescriptor- Parameters for the gather operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 502 of file Serializer.cpp.

References armnn::IgnoreUnused(), and GatherDescriptor::m_Axis.

505 {
506  IgnoreUnused(name);
507 
508  auto fbGatherDescriptor = CreateGatherDescriptor(m_flatBufferBuilder,
509  gatherDescriptor.m_Axis);
510  auto fbGatherBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Gather);
511  auto flatBufferLayer = serializer::CreateGatherLayer(m_flatBufferBuilder, fbGatherBaseLayer, fbGatherDescriptor);
512 
513  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_GatherLayer);
514 }
void IgnoreUnused(Ts &&...)
int32_t m_Axis
The axis in params to gather indices from.

◆ VisitGreaterLayer()

void VisitGreaterLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 516 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

517 {
518  IgnoreUnused(name);
519 
520  auto fbGreaterBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Greater);
521  auto fbGreaterLayer = serializer::CreateGreaterLayer(m_flatBufferBuilder, fbGreaterBaseLayer);
522 
523  CreateAnyLayer(fbGreaterLayer.o, serializer::Layer::Layer_GreaterLayer);
524 }
void IgnoreUnused(Ts &&...)

◆ VisitInputLayer()

void VisitInputLayer ( const armnn::IConnectableLayer layer,
armnn::LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
id- User generated id to uniquely identify a particular input. The same id needs to be specified when passing the inputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 86 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

87 {
88  IgnoreUnused(name);
89 
90  // Create FlatBuffer BaseLayer
91  auto flatBufferInputBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Input);
92 
93  // Create FlatBuffer BindableBaseLayer
94  auto flatBufferInputBindableBaseLayer = serializer::CreateBindableLayerBase(m_flatBufferBuilder,
95  flatBufferInputBaseLayer,
96  id);
97  // Push layer binding id to outputIds.
98  m_inputIds.push_back(id);
99 
100  // Create the FlatBuffer InputLayer
101  auto flatBufferInputLayer = serializer::CreateInputLayer(m_flatBufferBuilder, flatBufferInputBindableBaseLayer);
102 
103  // Add the AnyLayer to the FlatBufferLayers
104  CreateAnyLayer(flatBufferInputLayer.o, serializer::Layer::Layer_InputLayer);
105 }
void IgnoreUnused(Ts &&...)

◆ VisitInstanceNormalizationLayer()

void VisitInstanceNormalizationLayer ( const armnn::IConnectableLayer layer,
const armnn::InstanceNormalizationDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
desc- Parameters for the instance normalization operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 526 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), InstanceNormalizationDescriptor::m_Beta, InstanceNormalizationDescriptor::m_DataLayout, InstanceNormalizationDescriptor::m_Eps, and InstanceNormalizationDescriptor::m_Gamma.

Referenced by SerializerVisitor::GetSerializedLayers().

530 {
531  IgnoreUnused(name);
532 
533  auto fbDescriptor = serializer::CreateInstanceNormalizationDescriptor(
534  m_flatBufferBuilder,
535  instanceNormalizationDescriptor.m_Gamma,
536  instanceNormalizationDescriptor.m_Beta,
537  instanceNormalizationDescriptor.m_Eps,
538  GetFlatBufferDataLayout(instanceNormalizationDescriptor.m_DataLayout));
539 
540  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_InstanceNormalization);
541  auto fbLayer = serializer::CreateInstanceNormalizationLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
542 
543  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_InstanceNormalizationLayer);
544 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitL2NormalizationLayer()

void VisitL2NormalizationLayer ( const armnn::IConnectableLayer layer,
const armnn::L2NormalizationDescriptor desc,
const char *  name = nullptr 
)
overridevirtual

Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Normalization is performed along dimension 1, but requires a 4d input.

Parameters
layer- pointer to the layer which is calling back to this visit function.
desc- Parameters for the L2 normalization operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 546 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), L2NormalizationDescriptor::m_DataLayout, and L2NormalizationDescriptor::m_Eps.

Referenced by SerializerVisitor::GetSerializedLayers().

549 {
550  IgnoreUnused(name);
551 
552  // Create FlatBuffer BaseLayer
553  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_L2Normalization);
554 
555  // Create the FlatBuffer L2Normalization Descriptor
556  auto fbDescriptor = serializer::CreateL2NormalizationDescriptor(
557  m_flatBufferBuilder,
558  GetFlatBufferDataLayout(l2NormalizationDescriptor.m_DataLayout),
559  l2NormalizationDescriptor.m_Eps);
560 
561  // Create FlatBuffer layer
562  auto fbLayer = serializer::CreateL2NormalizationLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
563 
564  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_L2NormalizationLayer);
565 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitLogSoftmaxLayer()

void VisitLogSoftmaxLayer ( const armnn::IConnectableLayer layer,
const armnn::LogSoftmaxDescriptor logSoftmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
logSoftmaxDescriptor- LogSoftmaxDescriptor to configure the log softmax.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 567 of file Serializer.cpp.

References armnn::IgnoreUnused(), SoftmaxDescriptor::m_Axis, and SoftmaxDescriptor::m_Beta.

Referenced by SerializerVisitor::GetSerializedLayers().

570 {
571  IgnoreUnused(name);
572 
573  // Create FlatBuffer BaseLayer
574  auto flatBufferLogSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_LogSoftmax);
575 
576  // Create the FlatBuffer LogSoftmaxDescriptor
577  auto flatBufferLogSoftmaxDesc =
578  serializer::CreateLogSoftmaxDescriptor(m_flatBufferBuilder,
579  logSoftmaxDescriptor.m_Beta,
580  logSoftmaxDescriptor.m_Axis);
581 
582  // Create the FlatBuffer LogSoftmaxLayer
583  auto flatBufferLogSoftmaxLayer =
584  serializer::CreateLogSoftmaxLayer(m_flatBufferBuilder,
585  flatBufferLogSoftmaxBaseLayer,
586  flatBufferLogSoftmaxDesc);
587 
588  CreateAnyLayer(flatBufferLogSoftmaxLayer.o, serializer::Layer::Layer_LogSoftmaxLayer);
589 }
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
float m_Beta
Exponentiation value.
void IgnoreUnused(Ts &&...)

◆ VisitLstmLayer()

void VisitLstmLayer ( const armnn::IConnectableLayer layer,
const armnn::LstmDescriptor descriptor,
const armnn::LstmInputParams params,
const char *  name = nullptr 
)
overridevirtual

Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
descriptor- Parameters controlling the operation of the Lstm operation.
params- The weights and biases for the LSTM cell.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 591 of file Serializer.cpp.

References armnn::IgnoreUnused(), LstmDescriptor::m_ActivationFunc, LstmInputParams::m_CellBias, LstmInputParams::m_CellLayerNormWeights, LstmInputParams::m_CellToForgetWeights, LstmInputParams::m_CellToInputWeights, LstmInputParams::m_CellToOutputWeights, LstmDescriptor::m_CifgEnabled, LstmDescriptor::m_ClippingThresCell, LstmDescriptor::m_ClippingThresProj, LstmInputParams::m_ForgetGateBias, LstmInputParams::m_ForgetLayerNormWeights, LstmInputParams::m_InputGateBias, LstmInputParams::m_InputLayerNormWeights, LstmInputParams::m_InputToCellWeights, LstmInputParams::m_InputToForgetWeights, LstmInputParams::m_InputToInputWeights, LstmInputParams::m_InputToOutputWeights, LstmDescriptor::m_LayerNormEnabled, LstmInputParams::m_OutputGateBias, LstmInputParams::m_OutputLayerNormWeights, LstmDescriptor::m_PeepholeEnabled, LstmInputParams::m_ProjectionBias, LstmDescriptor::m_ProjectionEnabled, LstmInputParams::m_ProjectionWeights, LstmInputParams::m_RecurrentToCellWeights, LstmInputParams::m_RecurrentToForgetWeights, LstmInputParams::m_RecurrentToInputWeights, and LstmInputParams::m_RecurrentToOutputWeights.

Referenced by SerializerVisitor::GetSerializedLayers().

595 {
596  IgnoreUnused(name);
597 
598  auto fbLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Lstm);
599 
600  auto fbLstmDescriptor = serializer::CreateLstmDescriptor(
601  m_flatBufferBuilder,
602  descriptor.m_ActivationFunc,
603  descriptor.m_ClippingThresCell,
604  descriptor.m_ClippingThresProj,
605  descriptor.m_CifgEnabled,
606  descriptor.m_PeepholeEnabled,
607  descriptor.m_ProjectionEnabled,
608  descriptor.m_LayerNormEnabled);
609 
610  // Get mandatory input parameters
611  auto inputToForgetWeights = CreateConstTensorInfo(*params.m_InputToForgetWeights);
612  auto inputToCellWeights = CreateConstTensorInfo(*params.m_InputToCellWeights);
613  auto inputToOutputWeights = CreateConstTensorInfo(*params.m_InputToOutputWeights);
614  auto recurrentToForgetWeights = CreateConstTensorInfo(*params.m_RecurrentToForgetWeights);
615  auto recurrentToCellWeights = CreateConstTensorInfo(*params.m_RecurrentToCellWeights);
616  auto recurrentToOutputWeights = CreateConstTensorInfo(*params.m_RecurrentToOutputWeights);
617  auto forgetGateBias = CreateConstTensorInfo(*params.m_ForgetGateBias);
618  auto cellBias = CreateConstTensorInfo(*params.m_CellBias);
619  auto outputGateBias = CreateConstTensorInfo(*params.m_OutputGateBias);
620 
621  //Define optional parameters, these will be set depending on configuration in Lstm descriptor
622  flatbuffers::Offset<serializer::ConstTensor> inputToInputWeights;
623  flatbuffers::Offset<serializer::ConstTensor> recurrentToInputWeights;
624  flatbuffers::Offset<serializer::ConstTensor> cellToInputWeights;
625  flatbuffers::Offset<serializer::ConstTensor> inputGateBias;
626  flatbuffers::Offset<serializer::ConstTensor> projectionWeights;
627  flatbuffers::Offset<serializer::ConstTensor> projectionBias;
628  flatbuffers::Offset<serializer::ConstTensor> cellToForgetWeights;
629  flatbuffers::Offset<serializer::ConstTensor> cellToOutputWeights;
630  flatbuffers::Offset<serializer::ConstTensor> inputLayerNormWeights;
631  flatbuffers::Offset<serializer::ConstTensor> forgetLayerNormWeights;
632  flatbuffers::Offset<serializer::ConstTensor> cellLayerNormWeights;
633  flatbuffers::Offset<serializer::ConstTensor> outputLayerNormWeights;
634 
635  if (!descriptor.m_CifgEnabled)
636  {
637  inputToInputWeights = CreateConstTensorInfo(*params.m_InputToInputWeights);
638  recurrentToInputWeights = CreateConstTensorInfo(*params.m_RecurrentToInputWeights);
639  cellToInputWeights = CreateConstTensorInfo(*params.m_CellToInputWeights);
640  inputGateBias = CreateConstTensorInfo(*params.m_InputGateBias);
641  }
642 
643  if (descriptor.m_ProjectionEnabled)
644  {
645  projectionWeights = CreateConstTensorInfo(*params.m_ProjectionWeights);
646  projectionBias = CreateConstTensorInfo(*params.m_ProjectionBias);
647  }
648 
649  if (descriptor.m_PeepholeEnabled)
650  {
651  cellToForgetWeights = CreateConstTensorInfo(*params.m_CellToForgetWeights);
652  cellToOutputWeights = CreateConstTensorInfo(*params.m_CellToOutputWeights);
653  }
654 
655  if (descriptor.m_LayerNormEnabled)
656  {
657  if (!descriptor.m_CifgEnabled)
658  {
659  inputLayerNormWeights = CreateConstTensorInfo((*params.m_InputLayerNormWeights));
660  }
661  forgetLayerNormWeights = CreateConstTensorInfo(*params.m_ForgetLayerNormWeights);
662  cellLayerNormWeights = CreateConstTensorInfo(*params.m_CellLayerNormWeights);
663  outputLayerNormWeights = CreateConstTensorInfo(*params.m_OutputLayerNormWeights);
664  }
665 
666  auto fbLstmParams = serializer::CreateLstmInputParams(
667  m_flatBufferBuilder,
668  inputToForgetWeights,
669  inputToCellWeights,
670  inputToOutputWeights,
671  recurrentToForgetWeights,
672  recurrentToCellWeights,
673  recurrentToOutputWeights,
674  forgetGateBias,
675  cellBias,
676  outputGateBias,
677  inputToInputWeights,
678  recurrentToInputWeights,
679  cellToInputWeights,
680  inputGateBias,
681  projectionWeights,
682  projectionBias,
683  cellToForgetWeights,
684  cellToOutputWeights,
685  inputLayerNormWeights,
686  forgetLayerNormWeights,
687  cellLayerNormWeights,
688  outputLayerNormWeights);
689 
690  auto fbLstmLayer = serializer::CreateLstmLayer(
691  m_flatBufferBuilder,
692  fbLstmBaseLayer,
693  fbLstmDescriptor,
694  fbLstmParams);
695 
696  CreateAnyLayer(fbLstmLayer.o, serializer::Layer::Layer_LstmLayer);
697 }
bool m_ProjectionEnabled
Enable/disable the projection layer.
const ConstTensor * m_ProjectionWeights
Definition: LstmParams.hpp:55
const ConstTensor * m_CellBias
Definition: LstmParams.hpp:53
float m_ClippingThresProj
Clipping threshold value for the projection.
const ConstTensor * m_CellToOutputWeights
Definition: LstmParams.hpp:50
const ConstTensor * m_CellToInputWeights
Definition: LstmParams.hpp:48
const ConstTensor * m_InputGateBias
Definition: LstmParams.hpp:51
const ConstTensor * m_RecurrentToCellWeights
Definition: LstmParams.hpp:46
const ConstTensor * m_ForgetLayerNormWeights
Definition: LstmParams.hpp:58
const ConstTensor * m_CellToForgetWeights
Definition: LstmParams.hpp:49
void IgnoreUnused(Ts &&...)
const ConstTensor * m_OutputGateBias
Definition: LstmParams.hpp:54
const ConstTensor * m_InputLayerNormWeights
Definition: LstmParams.hpp:57
const ConstTensor * m_RecurrentToOutputWeights
Definition: LstmParams.hpp:47
const ConstTensor * m_ProjectionBias
Definition: LstmParams.hpp:56
bool m_PeepholeEnabled
Enable/disable peephole.
uint32_t m_ActivationFunc
The activation function to use.
float m_ClippingThresCell
Clipping threshold value for the cell state.
const ConstTensor * m_CellLayerNormWeights
Definition: LstmParams.hpp:59
const ConstTensor * m_ForgetGateBias
Definition: LstmParams.hpp:52
const ConstTensor * m_InputToCellWeights
Definition: LstmParams.hpp:42
const ConstTensor * m_InputToOutputWeights
Definition: LstmParams.hpp:43
bool m_CifgEnabled
Enable/disable cifg (coupled input & forget gate).
const ConstTensor * m_RecurrentToForgetWeights
Definition: LstmParams.hpp:45
const ConstTensor * m_RecurrentToInputWeights
Definition: LstmParams.hpp:44
bool m_LayerNormEnabled
Enable/disable layer normalization.
const ConstTensor * m_OutputLayerNormWeights
Definition: LstmParams.hpp:60
const ConstTensor * m_InputToForgetWeights
Definition: LstmParams.hpp:41
const ConstTensor * m_InputToInputWeights
Definition: LstmParams.hpp:40

◆ VisitMaximumLayer()

void VisitMaximumLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 699 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

700 {
701  IgnoreUnused(name);
702 
703  auto fbMaximumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Maximum);
704  auto fbMaximumLayer = serializer::CreateMaximumLayer(m_flatBufferBuilder, fbMaximumBaseLayer);
705 
706  CreateAnyLayer(fbMaximumLayer.o, serializer::Layer::Layer_MaximumLayer);
707 }
void IgnoreUnused(Ts &&...)

◆ VisitMeanLayer()

void VisitMeanLayer ( const armnn::IConnectableLayer layer,
const armnn::MeanDescriptor meanDescriptor,
const char *  name 
)
overridevirtual

Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
meanDescriptor- Parameters for the mean operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 709 of file Serializer.cpp.

References armnn::IgnoreUnused(), MeanDescriptor::m_Axis, and MeanDescriptor::m_KeepDims.

Referenced by SerializerVisitor::GetSerializedLayers().

712 {
713  IgnoreUnused(name);
714 
715  auto fbMeanBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Mean);
716  auto fbMeanDescriptor = serializer::CreateMeanDescriptor(m_flatBufferBuilder,
717  m_flatBufferBuilder.CreateVector(descriptor.m_Axis),
718  descriptor.m_KeepDims);
719 
720  auto fbMeanLayer = serializer::CreateMeanLayer(m_flatBufferBuilder,
721  fbMeanBaseLayer,
722  fbMeanDescriptor);
723 
724  CreateAnyLayer(fbMeanLayer.o, serializer::Layer::Layer_MeanLayer);
725 }
void IgnoreUnused(Ts &&...)

◆ VisitMergeLayer()

void VisitMergeLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 737 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

738 {
739  IgnoreUnused(name);
740 
741  auto fbMergeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Merge);
742  auto fbMergeLayer = serializer::CreateMergeLayer(m_flatBufferBuilder, fbMergeBaseLayer);
743 
744  CreateAnyLayer(fbMergeLayer.o, serializer::Layer::Layer_MergeLayer);
745 }
void IgnoreUnused(Ts &&...)

◆ VisitMergerLayer()

void VisitMergerLayer ( const armnn::IConnectableLayer layer,
const armnn::MergerDescriptor mergerDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
mergerDescriptor- MergerDescriptor (synonym for OriginsDescriptor) to configure the concatenation process. Number of Views must be equal to the number of inputs, and their order must match - e.g. first view corresponds to the first input, second view to the second input, etc....
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 747 of file Serializer.cpp.

Referenced by SerializerVisitor::GetSerializedLayers().

750 {
751  VisitConcatLayer(layer, mergerDescriptor, name);
752 }
void VisitConcatLayer(const armnn::IConnectableLayer *layer, const armnn::ConcatDescriptor &concatDescriptor, const char *name=nullptr) override
Function that a concat layer should call back to when its Accept(ILayerVisitor&) function is invoked...
Definition: Serializer.cpp:754

◆ VisitMinimumLayer()

void VisitMinimumLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 727 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

728 {
729  IgnoreUnused(name);
730 
731  auto fbMinimumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Minimum);
732  auto fbMinimumLayer = serializer::CreateMinimumLayer(m_flatBufferBuilder, fbMinimumBaseLayer);
733 
734  CreateAnyLayer(fbMinimumLayer.o, serializer::Layer::Layer_MinimumLayer);
735 }
void IgnoreUnused(Ts &&...)

◆ VisitMultiplicationLayer()

void VisitMultiplicationLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 789 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

790 {
791  IgnoreUnused(name);
792 
793  auto fbMultiplicationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Multiplication);
794  auto fbMultiplicationLayer = serializer::CreateMultiplicationLayer(m_flatBufferBuilder,
795  fbMultiplicationBaseLayer);
796 
797  CreateAnyLayer(fbMultiplicationLayer.o, serializer::Layer::Layer_MultiplicationLayer);
798 }
void IgnoreUnused(Ts &&...)

◆ VisitNormalizationLayer()

void VisitNormalizationLayer ( const armnn::IConnectableLayer layer,
const armnn::NormalizationDescriptor normalizationDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
normalizationDescriptor- NormalizationDescriptor to configure the normalization.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1197 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnnSerializer::GetFlatBufferNormalizationAlgorithmChannel(), armnnSerializer::GetFlatBufferNormalizationAlgorithmMethod(), armnn::IgnoreUnused(), NormalizationDescriptor::m_Alpha, NormalizationDescriptor::m_Beta, NormalizationDescriptor::m_DataLayout, NormalizationDescriptor::m_K, NormalizationDescriptor::m_NormChannelType, NormalizationDescriptor::m_NormMethodType, and NormalizationDescriptor::m_NormSize.

Referenced by SerializerVisitor::GetSerializedLayers().

1200 {
1201  IgnoreUnused(name);
1202 
1203  auto fbNormalizationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Normalization);
1204 
1205  auto fbNormalizationDescriptor = serializer::CreateNormalizationDescriptor(
1206  m_flatBufferBuilder,
1207  GetFlatBufferNormalizationAlgorithmChannel(descriptor.m_NormChannelType),
1208  GetFlatBufferNormalizationAlgorithmMethod(descriptor.m_NormMethodType),
1209  descriptor.m_NormSize,
1210  descriptor.m_Alpha,
1211  descriptor.m_Beta,
1212  descriptor.m_K,
1213  GetFlatBufferDataLayout(descriptor.m_DataLayout));
1214 
1215  auto flatBufferLayer = serializer::CreateNormalizationLayer(m_flatBufferBuilder,
1216  fbNormalizationBaseLayer,
1217  fbNormalizationDescriptor);
1218 
1219  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_NormalizationLayer);
1220 }
armnnSerializer::NormalizationAlgorithmMethod GetFlatBufferNormalizationAlgorithmMethod(armnn::NormalizationAlgorithmMethod normalizationAlgorithmMethod)
void IgnoreUnused(Ts &&...)
armnnSerializer::NormalizationAlgorithmChannel GetFlatBufferNormalizationAlgorithmChannel(armnn::NormalizationAlgorithmChannel normalizationAlgorithmChannel)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitOutputLayer()

void VisitOutputLayer ( const armnn::IConnectableLayer layer,
armnn::LayerBindingId  id,
const char *  name = nullptr 
)
overridevirtual

Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
id- User generated id to uniquely identify a particular output. The same id needs to be specified when passing the outputs to the IRuntime::EnqueueWorkload() function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 108 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

109 {
110  IgnoreUnused(name);
111 
112  // Create FlatBuffer BaseLayer
113  auto flatBufferOutputBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Output);
114 
115  // Create FlatBuffer BindableBaseLayer
116  auto flatBufferOutputBindableBaseLayer = serializer::CreateBindableLayerBase(m_flatBufferBuilder,
117  flatBufferOutputBaseLayer,
118  id);
119  // Push layer binding id to outputIds.
120  m_outputIds.push_back(id);
121 
122  // Create the FlatBuffer OutputLayer
123  auto flatBufferOutputLayer = serializer::CreateOutputLayer(m_flatBufferBuilder, flatBufferOutputBindableBaseLayer);
124  // Add the AnyLayer to the FlatBufferLayers
125  CreateAnyLayer(flatBufferOutputLayer.o, serializer::Layer::Layer_OutputLayer);
126 }
void IgnoreUnused(Ts &&...)

◆ VisitPadLayer()

void VisitPadLayer ( const armnn::IConnectableLayer layer,
const armnn::PadDescriptor padDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
paddings- n by 2 tensor, where n is the rank of the input tensor, such that paddings[i,0] indicates the amount of padding to add in front of dimension i, and paddings[i,1] indicates the amount of padding to add after the end of dimension i
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 800 of file Serializer.cpp.

References armnn::IgnoreUnused(), PadDescriptor::m_PadList, and PadDescriptor::m_PadValue.

Referenced by SerializerVisitor::GetSerializedLayers().

803 {
804  IgnoreUnused(name);
805 
806  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pad);
807 
808  std::vector<unsigned int> padList;
809  for (auto& p: padDescriptor.m_PadList)
810  {
811  padList.push_back(p.first);
812  padList.push_back(p.second);
813  }
814 
815  auto flatBufferPadDesc = serializer::CreatePadDescriptor(m_flatBufferBuilder,
816  m_flatBufferBuilder.CreateVector(padList),
817  padDescriptor.m_PadValue);
818 
819  auto flatBufferPadLayer = serializer::CreatePadLayer(m_flatBufferBuilder,
820  flatBufferBaseLayer,
821  flatBufferPadDesc);
822 
823  CreateAnyLayer(flatBufferPadLayer.o, serializer::Layer::Layer_PadLayer);
824 }
float m_PadValue
Optional value to use for padding, defaults to 0.
std::vector< std::pair< unsigned int, unsigned int > > m_PadList
Specifies the padding for input dimension.
void IgnoreUnused(Ts &&...)

◆ VisitPermuteLayer()

void VisitPermuteLayer ( const armnn::IConnectableLayer layer,
const armnn::PermuteDescriptor permuteDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
permuteDescriptor- PermuteDescriptor to configure the permute.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 826 of file Serializer.cpp.

References PermutationVector::GetSize(), armnn::IgnoreUnused(), and PermuteDescriptor::m_DimMappings.

Referenced by SerializerVisitor::GetSerializedLayers().

829 {
830  IgnoreUnused(name);
831 
832  // Create FlatBuffer BaseLayer
833  auto flatBufferPermuteBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Permute);
834 
835  std::vector<unsigned int> dimMappings;
836  for (unsigned int i=0; i<permuteDescriptor.m_DimMappings.GetSize(); ++i)
837  {
838  dimMappings.push_back(permuteDescriptor.m_DimMappings[i]);
839  }
840 
841  auto flatBufferPermuteDesc = serializer::CreatePermuteDescriptor(m_flatBufferBuilder,
842  m_flatBufferBuilder.CreateVector(dimMappings));
843 
844  // Create the FlatBuffer PermuteLayer
845  auto flatBufferPermuteLayer = serializer::CreatePermuteLayer(m_flatBufferBuilder,
846  flatBufferPermuteBaseLayer,
847  flatBufferPermuteDesc);
848 
849  // Add the AnyLayer to the FlatBufferLayers
850  CreateAnyLayer(flatBufferPermuteLayer.o, serializer::Layer::Layer_PermuteLayer);
851 }
void IgnoreUnused(Ts &&...)
SizeType GetSize() const
Definition: Types.hpp:225
PermutationVector m_DimMappings
Indicates how to translate tensor elements from a given source into the target destination, when source and target potentially have different memory layouts e.g.

◆ VisitPooling2dLayer()

void VisitPooling2dLayer ( const armnn::IConnectableLayer layer,
const armnn::Pooling2dDescriptor pooling2dDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
pooling2dDescriptor- Pooling2dDescriptor to configure the pooling.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 986 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnnSerializer::GetFlatBufferOutputShapeRounding(), armnnSerializer::GetFlatBufferPaddingMethod(), armnnSerializer::GetFlatBufferPoolingAlgorithm(), armnn::IgnoreUnused(), Pooling2dDescriptor::m_DataLayout, Pooling2dDescriptor::m_OutputShapeRounding, Pooling2dDescriptor::m_PadBottom, Pooling2dDescriptor::m_PaddingMethod, Pooling2dDescriptor::m_PadLeft, Pooling2dDescriptor::m_PadRight, Pooling2dDescriptor::m_PadTop, Pooling2dDescriptor::m_PoolHeight, Pooling2dDescriptor::m_PoolType, Pooling2dDescriptor::m_PoolWidth, Pooling2dDescriptor::m_StrideX, and Pooling2dDescriptor::m_StrideY.

Referenced by SerializerVisitor::GetSerializedLayers().

989 {
990  IgnoreUnused(name);
991 
992  auto fbPooling2dBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pooling2d);
993  auto fbPooling2dDescriptor = serializer::CreatePooling2dDescriptor(
994  m_flatBufferBuilder,
995  GetFlatBufferPoolingAlgorithm(pooling2dDescriptor.m_PoolType),
996  pooling2dDescriptor.m_PadLeft,
997  pooling2dDescriptor.m_PadRight,
998  pooling2dDescriptor.m_PadTop,
999  pooling2dDescriptor.m_PadBottom,
1000  pooling2dDescriptor.m_PoolWidth,
1001  pooling2dDescriptor.m_PoolHeight,
1002  pooling2dDescriptor.m_StrideX,
1003  pooling2dDescriptor.m_StrideY,
1005  GetFlatBufferPaddingMethod(pooling2dDescriptor.m_PaddingMethod),
1006  GetFlatBufferDataLayout(pooling2dDescriptor.m_DataLayout));
1007 
1008  auto fbPooling2dLayer = serializer::CreatePooling2dLayer(m_flatBufferBuilder,
1009  fbPooling2dBaseLayer,
1010  fbPooling2dDescriptor);
1011 
1012  CreateAnyLayer(fbPooling2dLayer.o, serializer::Layer::Layer_Pooling2dLayer);
1013 }
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_PoolWidth
Pooling width value.
armnnSerializer::OutputShapeRounding GetFlatBufferOutputShapeRounding(armnn::OutputShapeRounding outputShapeRounding)
PaddingMethod m_PaddingMethod
The padding method to be used. (Exclude, IgnoreValue).
uint32_t m_PadTop
Padding top value in the height dimension.
void IgnoreUnused(Ts &&...)
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_PoolHeight
Pooling height value.
uint32_t m_PadRight
Padding right value in the width dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
OutputShapeRounding m_OutputShapeRounding
The rounding method for the output shape. (Floor, Ceiling).
armnnSerializer::PaddingMethod GetFlatBufferPaddingMethod(armnn::PaddingMethod paddingMethod)
armnnSerializer::PoolingAlgorithm GetFlatBufferPoolingAlgorithm(armnn::PoolingAlgorithm poolingAlgorithm)
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.

◆ VisitPreluLayer()

void VisitPreluLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1015 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1017 {
1018  IgnoreUnused(name);
1019 
1020  // Create FlatBuffer BaseLayer
1021  auto flatBufferPreluBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Prelu);
1022 
1023  // Create the FlatBuffer AdditionLayer
1024  auto flatBufferPreluLayer = serializer::CreatePreluLayer(m_flatBufferBuilder, flatBufferPreluBaseLayer);
1025 
1026  // Add the AnyLayer to the FlatBufferLayers
1027  CreateAnyLayer(flatBufferPreluLayer.o, serializer::Layer::Layer_PreluLayer);
1028 }
void IgnoreUnused(Ts &&...)

◆ VisitQLstmLayer()

void VisitQLstmLayer ( const armnn::IConnectableLayer layer,
const armnn::QLstmDescriptor descriptor,
const armnn::LstmInputParams params,
const char *  name = nullptr 
)
overridevirtual

Function a QLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
descriptor- Parameters controlling the operation of the QLstm operation.
params- The weights and biases for the layer
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1372 of file Serializer.cpp.

References armnn::IgnoreUnused(), LstmInputParams::m_CellBias, QLstmDescriptor::m_CellClip, QLstmDescriptor::m_CellIntermediateScale, LstmInputParams::m_CellLayerNormWeights, LstmInputParams::m_CellToForgetWeights, LstmInputParams::m_CellToInputWeights, LstmInputParams::m_CellToOutputWeights, QLstmDescriptor::m_CifgEnabled, LstmInputParams::m_ForgetGateBias, QLstmDescriptor::m_ForgetIntermediateScale, LstmInputParams::m_ForgetLayerNormWeights, QLstmDescriptor::m_HiddenStateScale, QLstmDescriptor::m_HiddenStateZeroPoint, LstmInputParams::m_InputGateBias, QLstmDescriptor::m_InputIntermediateScale, LstmInputParams::m_InputLayerNormWeights, LstmInputParams::m_InputToCellWeights, LstmInputParams::m_InputToForgetWeights, LstmInputParams::m_InputToInputWeights, LstmInputParams::m_InputToOutputWeights, QLstmDescriptor::m_LayerNormEnabled, LstmInputParams::m_OutputGateBias, QLstmDescriptor::m_OutputIntermediateScale, LstmInputParams::m_OutputLayerNormWeights, QLstmDescriptor::m_PeepholeEnabled, LstmInputParams::m_ProjectionBias, QLstmDescriptor::m_ProjectionClip, QLstmDescriptor::m_ProjectionEnabled, LstmInputParams::m_ProjectionWeights, LstmInputParams::m_RecurrentToCellWeights, LstmInputParams::m_RecurrentToForgetWeights, LstmInputParams::m_RecurrentToInputWeights, and LstmInputParams::m_RecurrentToOutputWeights.

Referenced by SerializerVisitor::GetSerializedLayers().

1376 {
1377  IgnoreUnused(name);
1378 
1379  auto fbQLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_QLstm);
1380 
1381  auto fbQLstmDescriptor = serializer::CreateQLstmDescriptor(
1382  m_flatBufferBuilder,
1383  descriptor.m_CifgEnabled,
1384  descriptor.m_PeepholeEnabled,
1385  descriptor.m_ProjectionEnabled,
1386  descriptor.m_LayerNormEnabled,
1387  descriptor.m_CellClip,
1388  descriptor.m_ProjectionClip,
1389  descriptor.m_InputIntermediateScale,
1390  descriptor.m_ForgetIntermediateScale,
1391  descriptor.m_CellIntermediateScale,
1392  descriptor.m_OutputIntermediateScale,
1393  descriptor.m_HiddenStateZeroPoint,
1394  descriptor.m_HiddenStateScale
1395  );
1396 
1397  // Mandatory params
1398  auto inputToForgetWeights = CreateConstTensorInfo(*params.m_InputToForgetWeights);
1399  auto inputToCellWeights = CreateConstTensorInfo(*params.m_InputToCellWeights);
1400  auto inputToOutputWeights = CreateConstTensorInfo(*params.m_InputToOutputWeights);
1401  auto recurrentToForgetWeights = CreateConstTensorInfo(*params.m_RecurrentToForgetWeights);
1402  auto recurrentToCellWeights = CreateConstTensorInfo(*params.m_RecurrentToCellWeights);
1403  auto recurrentToOutputWeights = CreateConstTensorInfo(*params.m_RecurrentToOutputWeights);
1404  auto forgetGateBias = CreateConstTensorInfo(*params.m_ForgetGateBias);
1405  auto cellBias = CreateConstTensorInfo(*params.m_CellBias);
1406  auto outputGateBias = CreateConstTensorInfo(*params.m_OutputGateBias);
1407 
1408  // CIFG
1409  flatbuffers::Offset<serializer::ConstTensor> inputToInputWeights;
1410  flatbuffers::Offset<serializer::ConstTensor> recurrentToInputWeights;
1411  flatbuffers::Offset<serializer::ConstTensor> inputGateBias;
1412 
1413  if (!descriptor.m_CifgEnabled)
1414  {
1415  inputToInputWeights = CreateConstTensorInfo(*params.m_InputToInputWeights);
1416  recurrentToInputWeights = CreateConstTensorInfo(*params.m_RecurrentToInputWeights);
1417  inputGateBias = CreateConstTensorInfo(*params.m_InputGateBias);
1418  }
1419 
1420  // Projectiom
1421  flatbuffers::Offset<serializer::ConstTensor> projectionWeights;
1422  flatbuffers::Offset<serializer::ConstTensor> projectionBias;
1423 
1424  if (descriptor.m_ProjectionEnabled)
1425  {
1426  projectionWeights = CreateConstTensorInfo(*params.m_ProjectionWeights);
1427  projectionBias = CreateConstTensorInfo(*params.m_ProjectionBias);
1428  }
1429 
1430  // Peephole
1431  flatbuffers::Offset<serializer::ConstTensor> cellToInputWeights;
1432  flatbuffers::Offset<serializer::ConstTensor> cellToForgetWeights;
1433  flatbuffers::Offset<serializer::ConstTensor> cellToOutputWeights;
1434 
1435  if (descriptor.m_PeepholeEnabled)
1436  {
1437  if (!descriptor.m_CifgEnabled)
1438  {
1439  cellToInputWeights = CreateConstTensorInfo(*params.m_CellToInputWeights);
1440  }
1441 
1442  cellToForgetWeights = CreateConstTensorInfo(*params.m_CellToForgetWeights);
1443  cellToOutputWeights = CreateConstTensorInfo(*params.m_CellToOutputWeights);
1444  }
1445 
1446  // Layer norm
1447  flatbuffers::Offset<serializer::ConstTensor> inputLayerNormWeights;
1448  flatbuffers::Offset<serializer::ConstTensor> forgetLayerNormWeights;
1449  flatbuffers::Offset<serializer::ConstTensor> cellLayerNormWeights;
1450  flatbuffers::Offset<serializer::ConstTensor> outputLayerNormWeights;
1451 
1452  if (descriptor.m_LayerNormEnabled)
1453  {
1454  if (!descriptor.m_CifgEnabled)
1455  {
1456  inputLayerNormWeights = CreateConstTensorInfo((*params.m_InputLayerNormWeights));
1457  }
1458 
1459  forgetLayerNormWeights = CreateConstTensorInfo(*params.m_ForgetLayerNormWeights);
1460  cellLayerNormWeights = CreateConstTensorInfo(*params.m_CellLayerNormWeights);
1461  outputLayerNormWeights = CreateConstTensorInfo(*params.m_OutputLayerNormWeights);
1462  }
1463 
1464  auto fbQLstmParams = serializer::CreateQLstmInputParams(
1465  m_flatBufferBuilder,
1466  inputToForgetWeights,
1467  inputToCellWeights,
1468  inputToOutputWeights,
1469  recurrentToForgetWeights,
1470  recurrentToCellWeights,
1471  recurrentToOutputWeights,
1472  forgetGateBias,
1473  cellBias,
1474  outputGateBias,
1475  inputToInputWeights,
1476  recurrentToInputWeights,
1477  inputGateBias,
1478  projectionWeights,
1479  projectionBias,
1480  cellToInputWeights,
1481  cellToForgetWeights,
1482  cellToOutputWeights,
1483  inputLayerNormWeights,
1484  forgetLayerNormWeights,
1485  cellLayerNormWeights,
1486  outputLayerNormWeights);
1487 
1488  auto fbQLstmLayer = serializer::CreateQLstmLayer(
1489  m_flatBufferBuilder,
1490  fbQLstmBaseLayer,
1491  fbQLstmDescriptor,
1492  fbQLstmParams);
1493 
1494  CreateAnyLayer(fbQLstmLayer.o, serializer::Layer::Layer_QLstmLayer);
1495 }
const ConstTensor * m_ProjectionWeights
Definition: LstmParams.hpp:55
const ConstTensor * m_CellBias
Definition: LstmParams.hpp:53
const ConstTensor * m_CellToOutputWeights
Definition: LstmParams.hpp:50
bool m_PeepholeEnabled
Enable/disable peephole.
float m_HiddenStateScale
Hidden State quantization scale.
const ConstTensor * m_CellToInputWeights
Definition: LstmParams.hpp:48
float m_OutputIntermediateScale
Output intermediate quantization scale.
const ConstTensor * m_InputGateBias
Definition: LstmParams.hpp:51
const ConstTensor * m_RecurrentToCellWeights
Definition: LstmParams.hpp:46
const ConstTensor * m_ForgetLayerNormWeights
Definition: LstmParams.hpp:58
const ConstTensor * m_CellToForgetWeights
Definition: LstmParams.hpp:49
void IgnoreUnused(Ts &&...)
const ConstTensor * m_OutputGateBias
Definition: LstmParams.hpp:54
const ConstTensor * m_InputLayerNormWeights
Definition: LstmParams.hpp:57
bool m_LayerNormEnabled
Enable/disable layer normalization.
const ConstTensor * m_RecurrentToOutputWeights
Definition: LstmParams.hpp:47
const ConstTensor * m_ProjectionBias
Definition: LstmParams.hpp:56
float m_ProjectionClip
Clipping threshold value for the projection.
float m_InputIntermediateScale
Input intermediate quantization scale.
float m_ForgetIntermediateScale
Forget intermediate quantization scale.
const ConstTensor * m_CellLayerNormWeights
Definition: LstmParams.hpp:59
const ConstTensor * m_ForgetGateBias
Definition: LstmParams.hpp:52
const ConstTensor * m_InputToCellWeights
Definition: LstmParams.hpp:42
const ConstTensor * m_InputToOutputWeights
Definition: LstmParams.hpp:43
float m_CellClip
Clipping threshold value for the cell state.
const ConstTensor * m_RecurrentToForgetWeights
Definition: LstmParams.hpp:45
bool m_ProjectionEnabled
Enable/disable the projection layer.
const ConstTensor * m_RecurrentToInputWeights
Definition: LstmParams.hpp:44
const ConstTensor * m_OutputLayerNormWeights
Definition: LstmParams.hpp:60
float m_CellIntermediateScale
Cell intermediate quantization scale.
bool m_CifgEnabled
Enable/disable CIFG (coupled input & forget gate).
const ConstTensor * m_InputToForgetWeights
Definition: LstmParams.hpp:41
int32_t m_HiddenStateZeroPoint
Hidden State zero point.
const ConstTensor * m_InputToInputWeights
Definition: LstmParams.hpp:40

◆ VisitQuantizedLstmLayer()

void VisitQuantizedLstmLayer ( const armnn::IConnectableLayer layer,
const armnn::QuantizedLstmInputParams params,
const char *  name = nullptr 
)
overridevirtual

Function a QuantizedLstm layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
params- The weights and biases for the Quantized LSTM cell
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1497 of file Serializer.cpp.

References armnn::BFloat16, armnn::Boolean, armnn::Float16, armnn::Float32, QuantizedLstmInputParams::GetCellBias(), TensorInfo::GetDataType(), TensorShape::GetDimensionality(), armnnSerializer::GetFlatBufferConstTensorData(), armnnSerializer::GetFlatBufferDataType(), QuantizedLstmInputParams::GetForgetGateBias(), IConnectableLayer::GetGuid(), BaseTensor< MemoryType >::GetInfo(), QuantizedLstmInputParams::GetInputGateBias(), QuantizedLstmInputParams::GetInputToCellWeights(), QuantizedLstmInputParams::GetInputToForgetWeights(), QuantizedLstmInputParams::GetInputToInputWeights(), QuantizedLstmInputParams::GetInputToOutputWeights(), BaseTensor< MemoryType >::GetMemoryArea(), IConnectableLayer::GetName(), BaseTensor< MemoryType >::GetNumBytes(), TensorShape::GetNumDimensions(), QuantizedLstmInputParams::GetOutputGateBias(), TensorInfo::GetQuantizationDim(), TensorInfo::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), TensorInfo::GetQuantizationScales(), QuantizedLstmInputParams::GetRecurrentToCellWeights(), QuantizedLstmInputParams::GetRecurrentToForgetWeights(), QuantizedLstmInputParams::GetRecurrentToInputWeights(), QuantizedLstmInputParams::GetRecurrentToOutputWeights(), TensorInfo::GetShape(), TensorInfo::HasPerAxisQuantization(), armnn::IgnoreUnused(), armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::QSymmS8, armnn::Signed32, and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by SerializerVisitor::GetSerializedLayers().

1500 {
1501  IgnoreUnused(name);
1502 
1503  auto fbQuantizedLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_QuantizedLstm);
1504 
1505  // Get input parameters
1506  auto inputToInputWeights = CreateConstTensorInfo(params.GetInputToInputWeights());
1507  auto inputToForgetWeights = CreateConstTensorInfo(params.GetInputToForgetWeights());
1508  auto inputToCellWeights = CreateConstTensorInfo(params.GetInputToCellWeights());
1509  auto inputToOutputWeights = CreateConstTensorInfo(params.GetInputToOutputWeights());
1510 
1511  auto recurrentToInputWeights = CreateConstTensorInfo(params.GetRecurrentToInputWeights());
1512  auto recurrentToForgetWeights = CreateConstTensorInfo(params.GetRecurrentToForgetWeights());
1513  auto recurrentToCellWeights = CreateConstTensorInfo(params.GetRecurrentToCellWeights());
1514  auto recurrentToOutputWeights = CreateConstTensorInfo(params.GetRecurrentToOutputWeights());
1515 
1516  auto inputGateBias = CreateConstTensorInfo(params.GetInputGateBias());
1517  auto forgetGateBias = CreateConstTensorInfo(params.GetForgetGateBias());
1518  auto cellBias = CreateConstTensorInfo(params.GetCellBias());
1519  auto outputGateBias = CreateConstTensorInfo(params.GetOutputGateBias());
1520 
1521  auto fbQuantizedLstmParams = serializer::CreateQuantizedLstmInputParams(
1522  m_flatBufferBuilder,
1523  inputToInputWeights,
1524  inputToForgetWeights,
1525  inputToCellWeights,
1526  inputToOutputWeights,
1527  recurrentToInputWeights,
1528  recurrentToForgetWeights,
1529  recurrentToCellWeights,
1530  recurrentToOutputWeights,
1531  inputGateBias,
1532  forgetGateBias,
1533  cellBias,
1534  outputGateBias);
1535 
1536  auto fbQuantizedLstmLayer = serializer::CreateQuantizedLstmLayer(
1537  m_flatBufferBuilder,
1538  fbQuantizedLstmBaseLayer,
1539  fbQuantizedLstmParams);
1540 
1541  CreateAnyLayer(fbQuantizedLstmLayer.o, serializer::Layer::Layer_QuantizedLstmLayer);
1542 }
const ConstTensor & GetRecurrentToOutputWeights() const
const ConstTensor & GetRecurrentToForgetWeights() const
const ConstTensor & GetCellBias() const
void IgnoreUnused(Ts &&...)
const ConstTensor & GetInputToOutputWeights() const
const ConstTensor & GetInputToCellWeights() const
const ConstTensor & GetInputToInputWeights() const
const ConstTensor & GetForgetGateBias() const
const ConstTensor & GetInputGateBias() const
const ConstTensor & GetRecurrentToCellWeights() const
const ConstTensor & GetInputToForgetWeights() const
const ConstTensor & GetRecurrentToInputWeights() const
const ConstTensor & GetOutputGateBias() const

◆ VisitQuantizeLayer()

void VisitQuantizeLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1030 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1031 {
1032  IgnoreUnused(name);
1033 
1034  auto fbQuantizeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Quantize);
1035  auto fbQuantizeLayer = serializer::CreateQuantizeLayer(m_flatBufferBuilder,
1036  fbQuantizeBaseLayer);
1037  CreateAnyLayer(fbQuantizeLayer.o, serializer::Layer::Layer_QuantizeLayer);
1038 }
void IgnoreUnused(Ts &&...)

◆ VisitRankLayer()

void VisitRankLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a rank layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 854 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

856 {
857  IgnoreUnused(name);
858  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rank);
859  auto flatBufferRankLayer = serializer::CreateRankLayer(m_flatBufferBuilder, flatBufferBaseLayer);
860 
861  CreateAnyLayer(flatBufferRankLayer.o, serializer::Layer::Layer_RankLayer);
862 }
void IgnoreUnused(Ts &&...)

◆ VisitReshapeLayer()

void VisitReshapeLayer ( const armnn::IConnectableLayer layer,
const armnn::ReshapeDescriptor reshapeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a reshape layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
reshapeDescriptor- Parameters for the reshape operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 864 of file Serializer.cpp.

References TensorShape::GetNumDimensions(), armnn::IgnoreUnused(), and ReshapeDescriptor::m_TargetShape.

Referenced by SerializerVisitor::GetSerializedLayers().

867 {
868  IgnoreUnused(name);
869 
870  // Create FlatBuffer BaseLayer
871  auto flatBufferReshapeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Reshape);
872 
873  std::vector<unsigned int> targetShape;
874  for (unsigned int i =0; i < reshapeDescriptor.m_TargetShape.GetNumDimensions(); i++)
875  {
876  targetShape.push_back(reshapeDescriptor.m_TargetShape[i]);
877  }
878 
879  auto flatBufferReshapeDesc = serializer::CreateReshapeDescriptor(m_flatBufferBuilder,
880  m_flatBufferBuilder.CreateVector(targetShape));
881 
882  // Create the FlatBuffer ReshapeLayer
883  auto flatBufferReshapeLayer = serializer::CreateReshapeLayer(m_flatBufferBuilder, flatBufferReshapeBaseLayer,
884  flatBufferReshapeDesc);
885 
886  // Add the AnyLayer to the FlatBufferLayers
887  CreateAnyLayer(flatBufferReshapeLayer.o, serializer::Layer::Layer_ReshapeLayer);
888 }
void IgnoreUnused(Ts &&...)
TensorShape m_TargetShape
Target shape value.
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:175

◆ VisitResizeBilinearLayer()

void VisitResizeBilinearLayer ( const armnn::IConnectableLayer layer,
const armnn::ResizeBilinearDescriptor resizeDesc,
const char *  name = nullptr 
)
overridevirtual

Function that a resize bilinear layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
resizeDesc- Parameters for the resize operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 890 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), ResizeBilinearDescriptor::m_AlignCorners, ResizeBilinearDescriptor::m_DataLayout, ResizeBilinearDescriptor::m_HalfPixelCenters, ResizeBilinearDescriptor::m_TargetHeight, and ResizeBilinearDescriptor::m_TargetWidth.

Referenced by SerializerVisitor::GetSerializedLayers().

893 {
894  IgnoreUnused(name);
895 
896  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ResizeBilinear);
897 
898  auto flatBufferDescriptor =
899  CreateResizeBilinearDescriptor(m_flatBufferBuilder,
900  resizeDescriptor.m_TargetWidth,
901  resizeDescriptor.m_TargetHeight,
902  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
903  resizeDescriptor.m_AlignCorners,
904  resizeDescriptor.m_HalfPixelCenters);
905 
906  auto flatBufferLayer = serializer::CreateResizeBilinearLayer(m_flatBufferBuilder,
907  flatBufferBaseLayer,
908  flatBufferDescriptor);
909 
910  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeBilinearLayer);
911 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitResizeLayer()

void VisitResizeLayer ( const armnn::IConnectableLayer layer,
const armnn::ResizeDescriptor resizeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a resize layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
resizeDescriptor- Parameters for the resize operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 913 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnnSerializer::GetFlatBufferResizeMethod(), armnn::IgnoreUnused(), ResizeDescriptor::m_AlignCorners, ResizeDescriptor::m_DataLayout, ResizeDescriptor::m_HalfPixelCenters, ResizeDescriptor::m_Method, ResizeDescriptor::m_TargetHeight, and ResizeDescriptor::m_TargetWidth.

Referenced by SerializerVisitor::GetSerializedLayers().

916 {
917  IgnoreUnused(name);
918 
919  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Resize);
920 
921  auto flatBufferDescriptor =
922  CreateResizeDescriptor(m_flatBufferBuilder,
923  resizeDescriptor.m_TargetHeight,
924  resizeDescriptor.m_TargetWidth,
925  GetFlatBufferResizeMethod(resizeDescriptor.m_Method),
926  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
927  resizeDescriptor.m_AlignCorners,
928  resizeDescriptor.m_HalfPixelCenters);
929 
930  auto flatBufferLayer = serializer::CreateResizeLayer(m_flatBufferBuilder,
931  flatBufferBaseLayer,
932  flatBufferDescriptor);
933 
934  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeLayer);
935 }
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
void IgnoreUnused(Ts &&...)
uint32_t m_TargetWidth
Target width value.
bool m_HalfPixelCenters
Half Pixel Centers.
uint32_t m_TargetHeight
Target height value.
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
bool m_AlignCorners
Aligned corners.
armnnSerializer::ResizeMethod GetFlatBufferResizeMethod(armnn::ResizeMethod method)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).

◆ VisitRsqrtLayer()

void VisitRsqrtLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a Reciprocal of square root layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 937 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

938 {
939  IgnoreUnused(name);
940 
941  auto fbRsqrtBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rsqrt);
942  auto fbRsqrtLayer = serializer::CreateRsqrtLayer(m_flatBufferBuilder, fbRsqrtBaseLayer);
943 
944  CreateAnyLayer(fbRsqrtLayer.o, serializer::Layer::Layer_RsqrtLayer);
945 }
void IgnoreUnused(Ts &&...)

◆ VisitSliceLayer()

void VisitSliceLayer ( const armnn::IConnectableLayer layer,
const armnn::SliceDescriptor sliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
sliceDescriptor- SliceDescriptor to configure the slice operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 947 of file Serializer.cpp.

References armnn::IgnoreUnused(), SliceDescriptor::m_Begin, and SliceDescriptor::m_Size.

Referenced by SerializerVisitor::GetSerializedLayers().

950 {
951  IgnoreUnused(name);
952 
953  auto fbSliceBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Slice);
954  auto fbSliceDescriptor = CreateSliceDescriptor(m_flatBufferBuilder,
955  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Begin),
956  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Size));
957 
958  auto fbSliceLayer = serializer::CreateSliceLayer(m_flatBufferBuilder, fbSliceBaseLayer, fbSliceDescriptor);
959 
960  CreateAnyLayer(fbSliceLayer.o, serializer::Layer::Layer_SliceLayer);
961 }
std::vector< unsigned int > m_Size
Size of the slice in each dimension.
void IgnoreUnused(Ts &&...)
std::vector< unsigned int > m_Begin
Beginning indices of the slice in each dimension.

◆ VisitSoftmaxLayer()

void VisitSoftmaxLayer ( const armnn::IConnectableLayer layer,
const armnn::SoftmaxDescriptor softmaxDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
softmaxDescriptor- SoftmaxDescriptor to configure the softmax.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 964 of file Serializer.cpp.

References armnn::IgnoreUnused(), and SoftmaxDescriptor::m_Beta.

Referenced by SerializerVisitor::GetSerializedLayers().

967 {
968  IgnoreUnused(name);
969 
970  // Create FlatBuffer BaseLayer
971  auto flatBufferSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Softmax);
972 
973  // Create the FlatBuffer SoftmaxDescriptor
974  auto flatBufferSoftmaxDesc =
975  serializer::CreateSoftmaxDescriptor(m_flatBufferBuilder, softmaxDescriptor.m_Beta);
976 
977  // Create the FlatBuffer SoftmaxLayer
978  auto flatBufferSoftmaxLayer =
979  serializer::CreateSoftmaxLayer(m_flatBufferBuilder,
980  flatBufferSoftmaxBaseLayer,
981  flatBufferSoftmaxDesc);
982 
983  CreateAnyLayer(flatBufferSoftmaxLayer.o, serializer::Layer::Layer_SoftmaxLayer);
984 }
float m_Beta
Exponentiation value.
void IgnoreUnused(Ts &&...)

◆ VisitSpaceToBatchNdLayer()

void VisitSpaceToBatchNdLayer ( const armnn::IConnectableLayer layer,
const armnn::SpaceToBatchNdDescriptor spaceToBatchNdDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a space to batch layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
spaceToBatchNdDescriptor- Parameters for the space to batch operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1080 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), SpaceToBatchNdDescriptor::m_BlockShape, SpaceToBatchNdDescriptor::m_DataLayout, and SpaceToBatchNdDescriptor::m_PadList.

Referenced by SerializerVisitor::GetSerializedLayers().

1083 {
1084  IgnoreUnused(name);
1085 
1086  // Create FlatBuffer BaseLayer
1087  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToBatchNd);
1088 
1089  std::vector<unsigned int> padList;
1090  padList.reserve(spaceToBatchNdDescriptor.m_PadList.size()*2);
1091  for (auto& pad : spaceToBatchNdDescriptor.m_PadList)
1092  {
1093  padList.push_back(pad.first);
1094  padList.push_back(pad.second);
1095  }
1096 
1097  auto flatBufferDescriptor =
1098  CreateSpaceToBatchNdDescriptor(m_flatBufferBuilder,
1099  m_flatBufferBuilder.CreateVector(spaceToBatchNdDescriptor.m_BlockShape),
1100  m_flatBufferBuilder.CreateVector(padList),
1101  GetFlatBufferDataLayout(spaceToBatchNdDescriptor.m_DataLayout));
1102 
1103  auto flatBufferLayer = serializer::CreateSpaceToBatchNdLayer(m_flatBufferBuilder,
1104  flatBufferBaseLayer,
1105  flatBufferDescriptor);
1106 
1107  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToBatchNdLayer);
1108 }
void IgnoreUnused(Ts &&...)
std::vector< std::pair< unsigned int, unsigned int > > m_PadList
Specifies the padding values for the input dimension: heightPad{top, bottom} widthPad{left, right}.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
std::vector< unsigned int > m_BlockShape
Block shape value.
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitSpaceToDepthLayer()

void VisitSpaceToDepthLayer ( const armnn::IConnectableLayer layer,
const armnn::SpaceToDepthDescriptor spaceToDepthDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a space to depth layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
spaceToDepthDescriptor- Parameters for the space to depth operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1111 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), SpaceToDepthDescriptor::m_BlockSize, and SpaceToDepthDescriptor::m_DataLayout.

Referenced by SerializerVisitor::GetSerializedLayers().

1114 {
1115  IgnoreUnused(name);
1116 
1117  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToDepth);
1118  auto flatBufferDescriptor =
1119  CreateSpaceToDepthDescriptor(m_flatBufferBuilder,
1120  spaceToDepthDescriptor.m_BlockSize,
1121  GetFlatBufferDataLayout(spaceToDepthDescriptor.m_DataLayout));
1122 
1123  auto flatBufferLayer = serializer::CreateSpaceToDepthLayer(m_flatBufferBuilder,
1124  flatBufferBaseLayer,
1125  flatBufferDescriptor);
1126 
1127  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToDepthLayer);
1128 }
void IgnoreUnused(Ts &&...)
unsigned int m_BlockSize
Scalar specifying the input block size. It must be >= 1.
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).

◆ VisitSplitterLayer()

void VisitSplitterLayer ( const armnn::IConnectableLayer layer,
const armnn::ViewsDescriptor splitterDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a splitter layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
splitterDescriptor- ViewsDescriptor to configure the splitting process. Number of Views must be equal to the number of outputs, and their order must match - e.g. first view corresponds to the first output, second view to the second output, etc....
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1131 of file Serializer.cpp.

References OriginsDescriptor::GetConcatAxis(), OriginsDescriptor::GetNumDimensions(), ViewsDescriptor::GetNumDimensions(), OriginsDescriptor::GetNumViews(), ViewsDescriptor::GetNumViews(), ViewsDescriptor::GetOrigins(), ViewsDescriptor::GetViewOrigin(), ViewsDescriptor::GetViewSizes(), and armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1134 {
1135  IgnoreUnused(name);
1136 
1137  // Create FlatBuffer ViewOrigins
1138  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewOrigins;
1139  flatBufferViewOrigins.reserve(viewsDescriptor.GetNumViews());
1140 
1141  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1142  {
1143  std::vector<uint32_t> viewOrigin;
1144  viewOrigin.reserve(viewsDescriptor.GetNumDimensions());
1145 
1146  // Copy vector
1147  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1148  {
1149  viewOrigin.push_back(viewsDescriptor.GetViewOrigin(vIdx)[dIdx]);
1150  }
1151 
1152  flatBufferViewOrigins.push_back(CreateUintVector(m_flatBufferBuilder,
1153  m_flatBufferBuilder.CreateVector(viewOrigin)));
1154  }
1155 
1156  // Create FlatBuffer OriginsDescriptor
1157  auto flatBufferOriginDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
1158  viewsDescriptor.GetOrigins().GetConcatAxis(),
1159  viewsDescriptor.GetOrigins().GetNumViews(),
1160  viewsDescriptor.GetOrigins().GetNumDimensions(),
1161  m_flatBufferBuilder.CreateVector(flatBufferViewOrigins));
1162 
1163  // Create FlatBuffer ViewOrigins
1164  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewSizes;
1165  flatBufferViewSizes.reserve(viewsDescriptor.GetNumViews());
1166 
1167  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1168  {
1169  std::vector<uint32_t> viewSize;
1170  viewSize.reserve(viewsDescriptor.GetNumDimensions());
1171 
1172  // Copy vector
1173  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1174  {
1175  viewSize.push_back(viewsDescriptor.GetViewSizes(vIdx)[dIdx]);
1176  }
1177 
1178  flatBufferViewSizes.push_back(CreateUintVector(m_flatBufferBuilder,
1179  m_flatBufferBuilder.CreateVector(viewSize)));
1180  }
1181 
1182  // Create FlatBuffer ViewsDescriptor
1183  auto flatBufferViewsDescriptor = CreateViewsDescriptor(m_flatBufferBuilder,
1184  flatBufferOriginDescriptor,
1185  m_flatBufferBuilder.CreateVector(flatBufferViewSizes));
1186 
1187  // Create FlatBuffer BaseLayer
1188  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Splitter);
1189 
1190  auto flatBufferSplitterLayer = serializer::CreateSplitterLayer(m_flatBufferBuilder,
1191  flatBufferBaseLayer,
1192  flatBufferViewsDescriptor);
1193 
1194  CreateAnyLayer(flatBufferSplitterLayer.o, serializer::Layer::Layer_SplitterLayer);
1195 }
void IgnoreUnused(Ts &&...)

◆ VisitStackLayer()

void VisitStackLayer ( const armnn::IConnectableLayer layer,
const armnn::StackDescriptor stackDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a stack layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
stackDescriptor- Parameters for the stack operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1222 of file Serializer.cpp.

References TensorShape::GetNumDimensions(), armnn::IgnoreUnused(), StackDescriptor::m_Axis, StackDescriptor::m_InputShape, and StackDescriptor::m_NumInputs.

Referenced by SerializerVisitor::GetSerializedLayers().

1225 {
1226  IgnoreUnused(name);
1227 
1228  auto stackBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Stack);
1229 
1230  std::vector<unsigned int> inputShape;
1231  for (unsigned int i =0; i < stackDescriptor.m_InputShape.GetNumDimensions(); i++)
1232  {
1233  inputShape.push_back(stackDescriptor.m_InputShape[i]);
1234  }
1235 
1236  auto flatBufferStackDescriptor = CreateStackDescriptor(m_flatBufferBuilder,
1237  stackDescriptor.m_Axis,
1238  stackDescriptor.m_NumInputs,
1239  m_flatBufferBuilder.CreateVector(inputShape));
1240 
1241  auto stackLayer = serializer::CreateStackLayer(m_flatBufferBuilder, stackBaseLayer, flatBufferStackDescriptor);
1242  CreateAnyLayer(stackLayer.o, serializer::Layer::Layer_StackLayer);
1243 }
uint32_t m_Axis
0-based axis along which to stack the input tensors.
TensorShape m_InputShape
Required shape of all input tensors.
void IgnoreUnused(Ts &&...)
uint32_t m_NumInputs
Number of input tensors.
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:175

◆ VisitStandInLayer()

void VisitStandInLayer ( const armnn::IConnectableLayer layer,
const armnn::StandInDescriptor standInDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
standInDescriptor- Parameters for the stand-in layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1245 of file Serializer.cpp.

References armnn::IgnoreUnused(), StandInDescriptor::m_NumInputs, and StandInDescriptor::m_NumOutputs.

Referenced by SerializerVisitor::GetSerializedLayers().

1248 {
1249  IgnoreUnused(name);
1250 
1251  auto fbDescriptor = serializer::CreateStandInDescriptor(m_flatBufferBuilder,
1252  standInDescriptor.m_NumInputs,
1253  standInDescriptor.m_NumOutputs);
1254 
1255  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StandIn);
1256  auto fbLayer = serializer::CreateStandInLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
1257 
1258  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_StandInLayer);
1259 }
void IgnoreUnused(Ts &&...)
uint32_t m_NumOutputs
Number of output tensors.
uint32_t m_NumInputs
Number of input tensors.

◆ VisitStridedSliceLayer()

void VisitStridedSliceLayer ( const armnn::IConnectableLayer layer,
const armnn::StridedSliceDescriptor stridedSliceDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function a strided slice layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
stridedSliceDescriptor- Parameters for the strided slice operation.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1261 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), armnn::IgnoreUnused(), StridedSliceDescriptor::m_Begin, StridedSliceDescriptor::m_BeginMask, StridedSliceDescriptor::m_DataLayout, StridedSliceDescriptor::m_EllipsisMask, StridedSliceDescriptor::m_End, StridedSliceDescriptor::m_EndMask, StridedSliceDescriptor::m_NewAxisMask, StridedSliceDescriptor::m_ShrinkAxisMask, and StridedSliceDescriptor::m_Stride.

Referenced by SerializerVisitor::GetSerializedLayers().

1264 {
1265  IgnoreUnused(name);
1266 
1267  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StridedSlice);
1268 
1269  auto flatBufferDescriptor =
1270  CreateStridedSliceDescriptor(m_flatBufferBuilder,
1271  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Begin),
1272  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_End),
1273  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Stride),
1274  stridedSliceDescriptor.m_BeginMask,
1275  stridedSliceDescriptor.m_EndMask,
1276  stridedSliceDescriptor.m_ShrinkAxisMask,
1277  stridedSliceDescriptor.m_EllipsisMask,
1278  stridedSliceDescriptor.m_NewAxisMask,
1279  GetFlatBufferDataLayout(stridedSliceDescriptor.m_DataLayout));
1280 
1281  auto flatBufferLayer = serializer::CreateStridedSliceLayer(m_flatBufferBuilder,
1282  flatBufferBaseLayer,
1283  flatBufferDescriptor);
1284 
1285  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_StridedSliceLayer);
1286 }
int32_t m_ShrinkAxisMask
Shrink axis mask value. If set, the nth specification shrinks the dimensionality by 1...
std::vector< int > m_Begin
Begin values for the input that will be sliced.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
void IgnoreUnused(Ts &&...)
int32_t m_BeginMask
Begin mask value.
int32_t m_EndMask
End mask value.
int32_t m_NewAxisMask
New axis mask value.
int32_t m_EllipsisMask
Ellipsis mask value.
std::vector< int > m_Stride
Stride values for the input that will be sliced.
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
std::vector< int > m_End
End values for the input that will be sliced.

◆ VisitSubtractionLayer()

void VisitSubtractionLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a subtraction layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1288 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1289 {
1290  IgnoreUnused(name);
1291 
1292  auto fbSubtractionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Subtraction);
1293  auto fbSubtractionLayer = serializer::CreateSubtractionLayer(m_flatBufferBuilder, fbSubtractionBaseLayer);
1294 
1295  CreateAnyLayer(fbSubtractionLayer.o, serializer::Layer::Layer_SubtractionLayer);
1296 }
void IgnoreUnused(Ts &&...)

◆ VisitSwitchLayer()

void VisitSwitchLayer ( const armnn::IConnectableLayer layer,
const char *  name = nullptr 
)
overridevirtual

Function a switch layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1298 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1299 {
1300  IgnoreUnused(name);
1301 
1302  auto fbSwitchBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Switch);
1303  auto fbSwitchLayer = serializer::CreateSwitchLayer(m_flatBufferBuilder, fbSwitchBaseLayer);
1304 
1305  CreateAnyLayer(fbSwitchLayer.o, serializer::Layer::Layer_SwitchLayer);
1306 }
void IgnoreUnused(Ts &&...)

◆ VisitTransposeConvolution2dLayer()

void VisitTransposeConvolution2dLayer ( const armnn::IConnectableLayer layer,
const armnn::TransposeConvolution2dDescriptor descriptor,
const armnn::ConstTensor weights,
const armnn::Optional< armnn::ConstTensor > &  biases,
const char *  name = nullptr 
)
overridevirtual

Function that a 2D transpose convolution layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
descriptor- Description of the 2D transpose convolution layer.
weights- Tensor for the weights data.
biases- Optional tensor for the bias data.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1308 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferDataLayout(), OptionalBase::has_value(), armnn::IgnoreUnused(), TransposeConvolution2dDescriptor::m_BiasEnabled, TransposeConvolution2dDescriptor::m_DataLayout, TransposeConvolution2dDescriptor::m_PadBottom, TransposeConvolution2dDescriptor::m_PadLeft, TransposeConvolution2dDescriptor::m_PadRight, TransposeConvolution2dDescriptor::m_PadTop, TransposeConvolution2dDescriptor::m_StrideX, TransposeConvolution2dDescriptor::m_StrideY, and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by SerializerVisitor::GetSerializedLayers().

1314 {
1315  IgnoreUnused(name);
1316 
1317  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Convolution2d);
1318  auto fbDescriptor = CreateTransposeConvolution2dDescriptor(m_flatBufferBuilder,
1319  descriptor.m_PadLeft,
1320  descriptor.m_PadRight,
1321  descriptor.m_PadTop,
1322  descriptor.m_PadBottom,
1323  descriptor.m_StrideX,
1324  descriptor.m_StrideY,
1325  descriptor.m_BiasEnabled,
1327 
1328  // weights & biases
1329  auto fbWeightsConstTensorInfo = CreateConstTensorInfo(weights);
1330  flatbuffers::Offset<serializer::ConstTensor> fbBiasesConstTensorInfo;
1331  if (biases.has_value())
1332  {
1333  fbBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
1334  }
1335 
1336  auto fbLayer = CreateTransposeConvolution2dLayer(m_flatBufferBuilder,
1337  fbBaseLayer,
1338  fbDescriptor,
1339  fbWeightsConstTensorInfo,
1340  fbBiasesConstTensorInfo);
1341 
1342  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_TransposeConvolution2dLayer);
1343 }
bool m_BiasEnabled
Enable/disable bias.
void IgnoreUnused(Ts &&...)
uint32_t m_PadBottom
Padding bottom value in the height dimension.
bool has_value() const noexcept
Definition: Optional.hpp:53
uint32_t m_PadTop
Padding top value in the height dimension.
DataLayout m_DataLayout
The data layout to be used (NCHW, NHWC).
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
uint32_t m_PadLeft
Padding left value in the width dimension.
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
uint32_t m_PadRight
Padding right value in the width dimension.

◆ VisitTransposeLayer()

void VisitTransposeLayer ( const armnn::IConnectableLayer layer,
const armnn::TransposeDescriptor transposeDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a transpose layer should call back to when its Accept(ILayerVisitor&) function is invoked.

Parameters
layer- pointer to the layer which is calling back to this visit function.
transposeDescriptor- TransposeDescriptor to configure the transpose.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 1345 of file Serializer.cpp.

References PermutationVector::GetSize(), armnn::IgnoreUnused(), and TransposeDescriptor::m_DimMappings.

Referenced by SerializerVisitor::GetSerializedLayers().

1348 {
1349  IgnoreUnused(name);
1350 
1351  // Create FlatBuffer BaseLayer
1352  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Transpose);
1353 
1354  std::vector<unsigned int> dimMappings;
1355  for (unsigned int i=0; i<descriptor.m_DimMappings.GetSize(); ++i)
1356  {
1357  dimMappings.push_back(descriptor.m_DimMappings[i]);
1358  }
1359 
1360  auto flatBufferDesc = serializer::CreateTransposeDescriptor(m_flatBufferBuilder,
1361  m_flatBufferBuilder.CreateVector(dimMappings));
1362 
1363  // Create the FlatBuffer TransposeLayer
1364  auto flatBufferLayer = serializer::CreateTransposeLayer(m_flatBufferBuilder,
1365  flatBufferBaseLayer,
1366  flatBufferDesc);
1367 
1368  // Add the AnyLayer to the FlatBufferLayers
1369  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_TransposeLayer);
1370 }
void IgnoreUnused(Ts &&...)

The documentation for this class was generated from the following files: