ArmNN
 20.11
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 VisitLogicalBinaryLayer (const armnn::IConnectableLayer *layer, const armnn::LogicalBinaryDescriptor &descriptor, const char *name=nullptr) override
 Function that a logical binary 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::VisitLogicalBinaryLayer(), 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 1681 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().

1682 {
1683  flatbuffers::Offset<armnnSerializer::FeatureCompatibilityVersions> versionsTable =
1684  serializer::CreateFeatureCompatibilityVersions(
1685  m_flatBufferBuilder,
1686  1 // Binding ids scheme version
1687  );
1688  return versionsTable;
1689 }

◆ 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 769 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

772 {
773  IgnoreUnused(name);
774 
775  auto flatBufferConcatBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Concat);
776 
777  std::vector<flatbuffers::Offset<UintVector>> views;
778  for (unsigned int v = 0; v < concatDescriptor.GetNumViews(); ++v)
779  {
780  const uint32_t* origin = concatDescriptor.GetViewOrigin(v);
781  std::vector<uint32_t> origins;
782  for (unsigned int d = 0; d < concatDescriptor.GetNumDimensions(); ++d)
783  {
784  origins.push_back(origin[d]);
785  }
786  auto view = m_flatBufferBuilder.CreateVector(origins);
787  auto uintVector = CreateUintVector(m_flatBufferBuilder, view);
788  views.push_back(uintVector);
789  }
790 
791  auto flatBufferConcatDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
792  concatDescriptor.GetConcatAxis(),
793  concatDescriptor.GetNumViews(),
794  concatDescriptor.GetNumDimensions(),
795  m_flatBufferBuilder.CreateVector(views));
796 
797  auto flatBufferLayer = CreateConcatLayer(m_flatBufferBuilder,
798  flatBufferConcatBaseLayer,
799  flatBufferConcatDescriptor);
800 
801  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ConcatLayer);
802 }
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 1056 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1061 {
1062  IgnoreUnused(name);
1063 
1064  // Create FlatBuffer BaseLayer
1065  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_FullyConnected);
1066 
1067  // Create FlatBuffer FullyConnectedDescriptor
1068  auto flatBufferDescriptor =
1069  serializer::CreateFullyConnectedDescriptor(m_flatBufferBuilder,
1070  fullyConnectedDescriptor.m_BiasEnabled,
1071  fullyConnectedDescriptor.m_TransposeWeightMatrix);
1072 
1073  // Create FlatBuffer weights data
1074  auto flatBufferWeights = CreateConstTensorInfo(weights);
1075 
1076  // Create FlatBuffer bias data
1077  flatbuffers::Offset<serializer::ConstTensor> flatBufferBiases;
1078  if (fullyConnectedDescriptor.m_BiasEnabled)
1079  {
1080  flatBufferBiases = CreateConstTensorInfo(biases.value());
1081  }
1082 
1083  // Create FlatBuffer FullyConnectedLayer
1084  auto flatBufferLayer = serializer::CreateFullyConnectedLayer(m_flatBufferBuilder,
1085  flatBufferBaseLayer,
1086  flatBufferDescriptor,
1087  flatBufferWeights,
1088  flatBufferBiases);
1089 
1090  // Add created FullyConnectedLayer to the FlatBufferLayers
1091  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_FullyConnectedLayer);
1092 }
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)

◆ VisitLogicalBinaryLayer()

void VisitLogicalBinaryLayer ( const armnn::IConnectableLayer layer,
const armnn::LogicalBinaryDescriptor logicalBinaryDescriptor,
const char *  name = nullptr 
)
overridevirtual

Function that a logical binary 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.
logicalBinaryDescriptor- LogicalBinaryDescriptor to configure the logical unary layer.
name- Optional name for the layer.

Implements ILayerVisitor.

Definition at line 567 of file Serializer.cpp.

References armnnSerializer::GetFlatBufferLogicalBinaryOperation(), armnn::IgnoreUnused(), and LogicalBinaryDescriptor::m_Operation.

Referenced by SerializerVisitor::GetSerializedLayers().

570 {
571  IgnoreUnused(name);
572 
573  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_LogicalBinary);
574  auto fbDescriptor = serializer::CreateLogicalBinaryDescriptor(
575  m_flatBufferBuilder,
576  GetFlatBufferLogicalBinaryOperation(descriptor.m_Operation));
577 
578  auto fbLayer = serializer::CreateLogicalBinaryLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
579  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_LogicalBinaryLayer);
580 }
void IgnoreUnused(Ts &&...)
armnnSerializer::LogicalBinaryOperation GetFlatBufferLogicalBinaryOperation(armnn::LogicalBinaryOperation logicalBinaryOperation)

◆ 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 582 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

585 {
586  IgnoreUnused(name);
587 
588  // Create FlatBuffer BaseLayer
589  auto flatBufferLogSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_LogSoftmax);
590 
591  // Create the FlatBuffer LogSoftmaxDescriptor
592  auto flatBufferLogSoftmaxDesc =
593  serializer::CreateLogSoftmaxDescriptor(m_flatBufferBuilder,
594  logSoftmaxDescriptor.m_Beta,
595  logSoftmaxDescriptor.m_Axis);
596 
597  // Create the FlatBuffer LogSoftmaxLayer
598  auto flatBufferLogSoftmaxLayer =
599  serializer::CreateLogSoftmaxLayer(m_flatBufferBuilder,
600  flatBufferLogSoftmaxBaseLayer,
601  flatBufferLogSoftmaxDesc);
602 
603  CreateAnyLayer(flatBufferLogSoftmaxLayer.o, serializer::Layer::Layer_LogSoftmaxLayer);
604 }
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 606 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().

610 {
611  IgnoreUnused(name);
612 
613  auto fbLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Lstm);
614 
615  auto fbLstmDescriptor = serializer::CreateLstmDescriptor(
616  m_flatBufferBuilder,
617  descriptor.m_ActivationFunc,
618  descriptor.m_ClippingThresCell,
619  descriptor.m_ClippingThresProj,
620  descriptor.m_CifgEnabled,
621  descriptor.m_PeepholeEnabled,
622  descriptor.m_ProjectionEnabled,
623  descriptor.m_LayerNormEnabled);
624 
625  // Get mandatory input parameters
626  auto inputToForgetWeights = CreateConstTensorInfo(*params.m_InputToForgetWeights);
627  auto inputToCellWeights = CreateConstTensorInfo(*params.m_InputToCellWeights);
628  auto inputToOutputWeights = CreateConstTensorInfo(*params.m_InputToOutputWeights);
629  auto recurrentToForgetWeights = CreateConstTensorInfo(*params.m_RecurrentToForgetWeights);
630  auto recurrentToCellWeights = CreateConstTensorInfo(*params.m_RecurrentToCellWeights);
631  auto recurrentToOutputWeights = CreateConstTensorInfo(*params.m_RecurrentToOutputWeights);
632  auto forgetGateBias = CreateConstTensorInfo(*params.m_ForgetGateBias);
633  auto cellBias = CreateConstTensorInfo(*params.m_CellBias);
634  auto outputGateBias = CreateConstTensorInfo(*params.m_OutputGateBias);
635 
636  //Define optional parameters, these will be set depending on configuration in Lstm descriptor
637  flatbuffers::Offset<serializer::ConstTensor> inputToInputWeights;
638  flatbuffers::Offset<serializer::ConstTensor> recurrentToInputWeights;
639  flatbuffers::Offset<serializer::ConstTensor> cellToInputWeights;
640  flatbuffers::Offset<serializer::ConstTensor> inputGateBias;
641  flatbuffers::Offset<serializer::ConstTensor> projectionWeights;
642  flatbuffers::Offset<serializer::ConstTensor> projectionBias;
643  flatbuffers::Offset<serializer::ConstTensor> cellToForgetWeights;
644  flatbuffers::Offset<serializer::ConstTensor> cellToOutputWeights;
645  flatbuffers::Offset<serializer::ConstTensor> inputLayerNormWeights;
646  flatbuffers::Offset<serializer::ConstTensor> forgetLayerNormWeights;
647  flatbuffers::Offset<serializer::ConstTensor> cellLayerNormWeights;
648  flatbuffers::Offset<serializer::ConstTensor> outputLayerNormWeights;
649 
650  if (!descriptor.m_CifgEnabled)
651  {
652  inputToInputWeights = CreateConstTensorInfo(*params.m_InputToInputWeights);
653  recurrentToInputWeights = CreateConstTensorInfo(*params.m_RecurrentToInputWeights);
654  cellToInputWeights = CreateConstTensorInfo(*params.m_CellToInputWeights);
655  inputGateBias = CreateConstTensorInfo(*params.m_InputGateBias);
656  }
657 
658  if (descriptor.m_ProjectionEnabled)
659  {
660  projectionWeights = CreateConstTensorInfo(*params.m_ProjectionWeights);
661  projectionBias = CreateConstTensorInfo(*params.m_ProjectionBias);
662  }
663 
664  if (descriptor.m_PeepholeEnabled)
665  {
666  cellToForgetWeights = CreateConstTensorInfo(*params.m_CellToForgetWeights);
667  cellToOutputWeights = CreateConstTensorInfo(*params.m_CellToOutputWeights);
668  }
669 
670  if (descriptor.m_LayerNormEnabled)
671  {
672  if (!descriptor.m_CifgEnabled)
673  {
674  inputLayerNormWeights = CreateConstTensorInfo((*params.m_InputLayerNormWeights));
675  }
676  forgetLayerNormWeights = CreateConstTensorInfo(*params.m_ForgetLayerNormWeights);
677  cellLayerNormWeights = CreateConstTensorInfo(*params.m_CellLayerNormWeights);
678  outputLayerNormWeights = CreateConstTensorInfo(*params.m_OutputLayerNormWeights);
679  }
680 
681  auto fbLstmParams = serializer::CreateLstmInputParams(
682  m_flatBufferBuilder,
683  inputToForgetWeights,
684  inputToCellWeights,
685  inputToOutputWeights,
686  recurrentToForgetWeights,
687  recurrentToCellWeights,
688  recurrentToOutputWeights,
689  forgetGateBias,
690  cellBias,
691  outputGateBias,
692  inputToInputWeights,
693  recurrentToInputWeights,
694  cellToInputWeights,
695  inputGateBias,
696  projectionWeights,
697  projectionBias,
698  cellToForgetWeights,
699  cellToOutputWeights,
700  inputLayerNormWeights,
701  forgetLayerNormWeights,
702  cellLayerNormWeights,
703  outputLayerNormWeights);
704 
705  auto fbLstmLayer = serializer::CreateLstmLayer(
706  m_flatBufferBuilder,
707  fbLstmBaseLayer,
708  fbLstmDescriptor,
709  fbLstmParams);
710 
711  CreateAnyLayer(fbLstmLayer.o, serializer::Layer::Layer_LstmLayer);
712 }
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 714 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

715 {
716  IgnoreUnused(name);
717 
718  auto fbMaximumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Maximum);
719  auto fbMaximumLayer = serializer::CreateMaximumLayer(m_flatBufferBuilder, fbMaximumBaseLayer);
720 
721  CreateAnyLayer(fbMaximumLayer.o, serializer::Layer::Layer_MaximumLayer);
722 }
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 724 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

727 {
728  IgnoreUnused(name);
729 
730  auto fbMeanBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Mean);
731  auto fbMeanDescriptor = serializer::CreateMeanDescriptor(m_flatBufferBuilder,
732  m_flatBufferBuilder.CreateVector(descriptor.m_Axis),
733  descriptor.m_KeepDims);
734 
735  auto fbMeanLayer = serializer::CreateMeanLayer(m_flatBufferBuilder,
736  fbMeanBaseLayer,
737  fbMeanDescriptor);
738 
739  CreateAnyLayer(fbMeanLayer.o, serializer::Layer::Layer_MeanLayer);
740 }
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 752 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

753 {
754  IgnoreUnused(name);
755 
756  auto fbMergeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Merge);
757  auto fbMergeLayer = serializer::CreateMergeLayer(m_flatBufferBuilder, fbMergeBaseLayer);
758 
759  CreateAnyLayer(fbMergeLayer.o, serializer::Layer::Layer_MergeLayer);
760 }
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 762 of file Serializer.cpp.

Referenced by SerializerVisitor::GetSerializedLayers().

765 {
766  VisitConcatLayer(layer, mergerDescriptor, name);
767 }
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:769

◆ 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 742 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

743 {
744  IgnoreUnused(name);
745 
746  auto fbMinimumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Minimum);
747  auto fbMinimumLayer = serializer::CreateMinimumLayer(m_flatBufferBuilder, fbMinimumBaseLayer);
748 
749  CreateAnyLayer(fbMinimumLayer.o, serializer::Layer::Layer_MinimumLayer);
750 }
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 804 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

805 {
806  IgnoreUnused(name);
807 
808  auto fbMultiplicationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Multiplication);
809  auto fbMultiplicationLayer = serializer::CreateMultiplicationLayer(m_flatBufferBuilder,
810  fbMultiplicationBaseLayer);
811 
812  CreateAnyLayer(fbMultiplicationLayer.o, serializer::Layer::Layer_MultiplicationLayer);
813 }
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 1212 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().

1215 {
1216  IgnoreUnused(name);
1217 
1218  auto fbNormalizationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Normalization);
1219 
1220  auto fbNormalizationDescriptor = serializer::CreateNormalizationDescriptor(
1221  m_flatBufferBuilder,
1222  GetFlatBufferNormalizationAlgorithmChannel(descriptor.m_NormChannelType),
1223  GetFlatBufferNormalizationAlgorithmMethod(descriptor.m_NormMethodType),
1224  descriptor.m_NormSize,
1225  descriptor.m_Alpha,
1226  descriptor.m_Beta,
1227  descriptor.m_K,
1228  GetFlatBufferDataLayout(descriptor.m_DataLayout));
1229 
1230  auto flatBufferLayer = serializer::CreateNormalizationLayer(m_flatBufferBuilder,
1231  fbNormalizationBaseLayer,
1232  fbNormalizationDescriptor);
1233 
1234  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_NormalizationLayer);
1235 }
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 815 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

818 {
819  IgnoreUnused(name);
820 
821  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pad);
822 
823  std::vector<unsigned int> padList;
824  for (auto& p: padDescriptor.m_PadList)
825  {
826  padList.push_back(p.first);
827  padList.push_back(p.second);
828  }
829 
830  auto flatBufferPadDesc = serializer::CreatePadDescriptor(m_flatBufferBuilder,
831  m_flatBufferBuilder.CreateVector(padList),
832  padDescriptor.m_PadValue);
833 
834  auto flatBufferPadLayer = serializer::CreatePadLayer(m_flatBufferBuilder,
835  flatBufferBaseLayer,
836  flatBufferPadDesc);
837 
838  CreateAnyLayer(flatBufferPadLayer.o, serializer::Layer::Layer_PadLayer);
839 }
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 841 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

844 {
845  IgnoreUnused(name);
846 
847  // Create FlatBuffer BaseLayer
848  auto flatBufferPermuteBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Permute);
849 
850  std::vector<unsigned int> dimMappings;
851  for (unsigned int i=0; i<permuteDescriptor.m_DimMappings.GetSize(); ++i)
852  {
853  dimMappings.push_back(permuteDescriptor.m_DimMappings[i]);
854  }
855 
856  auto flatBufferPermuteDesc = serializer::CreatePermuteDescriptor(m_flatBufferBuilder,
857  m_flatBufferBuilder.CreateVector(dimMappings));
858 
859  // Create the FlatBuffer PermuteLayer
860  auto flatBufferPermuteLayer = serializer::CreatePermuteLayer(m_flatBufferBuilder,
861  flatBufferPermuteBaseLayer,
862  flatBufferPermuteDesc);
863 
864  // Add the AnyLayer to the FlatBufferLayers
865  CreateAnyLayer(flatBufferPermuteLayer.o, serializer::Layer::Layer_PermuteLayer);
866 }
void IgnoreUnused(Ts &&...)
SizeType GetSize() const
Definition: Types.hpp:233
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 1001 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().

1004 {
1005  IgnoreUnused(name);
1006 
1007  auto fbPooling2dBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pooling2d);
1008  auto fbPooling2dDescriptor = serializer::CreatePooling2dDescriptor(
1009  m_flatBufferBuilder,
1010  GetFlatBufferPoolingAlgorithm(pooling2dDescriptor.m_PoolType),
1011  pooling2dDescriptor.m_PadLeft,
1012  pooling2dDescriptor.m_PadRight,
1013  pooling2dDescriptor.m_PadTop,
1014  pooling2dDescriptor.m_PadBottom,
1015  pooling2dDescriptor.m_PoolWidth,
1016  pooling2dDescriptor.m_PoolHeight,
1017  pooling2dDescriptor.m_StrideX,
1018  pooling2dDescriptor.m_StrideY,
1020  GetFlatBufferPaddingMethod(pooling2dDescriptor.m_PaddingMethod),
1021  GetFlatBufferDataLayout(pooling2dDescriptor.m_DataLayout));
1022 
1023  auto fbPooling2dLayer = serializer::CreatePooling2dLayer(m_flatBufferBuilder,
1024  fbPooling2dBaseLayer,
1025  fbPooling2dDescriptor);
1026 
1027  CreateAnyLayer(fbPooling2dLayer.o, serializer::Layer::Layer_Pooling2dLayer);
1028 }
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 1030 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1032 {
1033  IgnoreUnused(name);
1034 
1035  // Create FlatBuffer BaseLayer
1036  auto flatBufferPreluBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Prelu);
1037 
1038  // Create the FlatBuffer AdditionLayer
1039  auto flatBufferPreluLayer = serializer::CreatePreluLayer(m_flatBufferBuilder, flatBufferPreluBaseLayer);
1040 
1041  // Add the AnyLayer to the FlatBufferLayers
1042  CreateAnyLayer(flatBufferPreluLayer.o, serializer::Layer::Layer_PreluLayer);
1043 }
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 1387 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().

1391 {
1392  IgnoreUnused(name);
1393 
1394  auto fbQLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_QLstm);
1395 
1396  auto fbQLstmDescriptor = serializer::CreateQLstmDescriptor(
1397  m_flatBufferBuilder,
1398  descriptor.m_CifgEnabled,
1399  descriptor.m_PeepholeEnabled,
1400  descriptor.m_ProjectionEnabled,
1401  descriptor.m_LayerNormEnabled,
1402  descriptor.m_CellClip,
1403  descriptor.m_ProjectionClip,
1404  descriptor.m_InputIntermediateScale,
1405  descriptor.m_ForgetIntermediateScale,
1406  descriptor.m_CellIntermediateScale,
1407  descriptor.m_OutputIntermediateScale,
1408  descriptor.m_HiddenStateZeroPoint,
1409  descriptor.m_HiddenStateScale
1410  );
1411 
1412  // Mandatory params
1413  auto inputToForgetWeights = CreateConstTensorInfo(*params.m_InputToForgetWeights);
1414  auto inputToCellWeights = CreateConstTensorInfo(*params.m_InputToCellWeights);
1415  auto inputToOutputWeights = CreateConstTensorInfo(*params.m_InputToOutputWeights);
1416  auto recurrentToForgetWeights = CreateConstTensorInfo(*params.m_RecurrentToForgetWeights);
1417  auto recurrentToCellWeights = CreateConstTensorInfo(*params.m_RecurrentToCellWeights);
1418  auto recurrentToOutputWeights = CreateConstTensorInfo(*params.m_RecurrentToOutputWeights);
1419  auto forgetGateBias = CreateConstTensorInfo(*params.m_ForgetGateBias);
1420  auto cellBias = CreateConstTensorInfo(*params.m_CellBias);
1421  auto outputGateBias = CreateConstTensorInfo(*params.m_OutputGateBias);
1422 
1423  // CIFG
1424  flatbuffers::Offset<serializer::ConstTensor> inputToInputWeights;
1425  flatbuffers::Offset<serializer::ConstTensor> recurrentToInputWeights;
1426  flatbuffers::Offset<serializer::ConstTensor> inputGateBias;
1427 
1428  if (!descriptor.m_CifgEnabled)
1429  {
1430  inputToInputWeights = CreateConstTensorInfo(*params.m_InputToInputWeights);
1431  recurrentToInputWeights = CreateConstTensorInfo(*params.m_RecurrentToInputWeights);
1432  inputGateBias = CreateConstTensorInfo(*params.m_InputGateBias);
1433  }
1434 
1435  // Projectiom
1436  flatbuffers::Offset<serializer::ConstTensor> projectionWeights;
1437  flatbuffers::Offset<serializer::ConstTensor> projectionBias;
1438 
1439  if (descriptor.m_ProjectionEnabled)
1440  {
1441  projectionWeights = CreateConstTensorInfo(*params.m_ProjectionWeights);
1442  projectionBias = CreateConstTensorInfo(*params.m_ProjectionBias);
1443  }
1444 
1445  // Peephole
1446  flatbuffers::Offset<serializer::ConstTensor> cellToInputWeights;
1447  flatbuffers::Offset<serializer::ConstTensor> cellToForgetWeights;
1448  flatbuffers::Offset<serializer::ConstTensor> cellToOutputWeights;
1449 
1450  if (descriptor.m_PeepholeEnabled)
1451  {
1452  if (!descriptor.m_CifgEnabled)
1453  {
1454  cellToInputWeights = CreateConstTensorInfo(*params.m_CellToInputWeights);
1455  }
1456 
1457  cellToForgetWeights = CreateConstTensorInfo(*params.m_CellToForgetWeights);
1458  cellToOutputWeights = CreateConstTensorInfo(*params.m_CellToOutputWeights);
1459  }
1460 
1461  // Layer norm
1462  flatbuffers::Offset<serializer::ConstTensor> inputLayerNormWeights;
1463  flatbuffers::Offset<serializer::ConstTensor> forgetLayerNormWeights;
1464  flatbuffers::Offset<serializer::ConstTensor> cellLayerNormWeights;
1465  flatbuffers::Offset<serializer::ConstTensor> outputLayerNormWeights;
1466 
1467  if (descriptor.m_LayerNormEnabled)
1468  {
1469  if (!descriptor.m_CifgEnabled)
1470  {
1471  inputLayerNormWeights = CreateConstTensorInfo((*params.m_InputLayerNormWeights));
1472  }
1473 
1474  forgetLayerNormWeights = CreateConstTensorInfo(*params.m_ForgetLayerNormWeights);
1475  cellLayerNormWeights = CreateConstTensorInfo(*params.m_CellLayerNormWeights);
1476  outputLayerNormWeights = CreateConstTensorInfo(*params.m_OutputLayerNormWeights);
1477  }
1478 
1479  auto fbQLstmParams = serializer::CreateQLstmInputParams(
1480  m_flatBufferBuilder,
1481  inputToForgetWeights,
1482  inputToCellWeights,
1483  inputToOutputWeights,
1484  recurrentToForgetWeights,
1485  recurrentToCellWeights,
1486  recurrentToOutputWeights,
1487  forgetGateBias,
1488  cellBias,
1489  outputGateBias,
1490  inputToInputWeights,
1491  recurrentToInputWeights,
1492  inputGateBias,
1493  projectionWeights,
1494  projectionBias,
1495  cellToInputWeights,
1496  cellToForgetWeights,
1497  cellToOutputWeights,
1498  inputLayerNormWeights,
1499  forgetLayerNormWeights,
1500  cellLayerNormWeights,
1501  outputLayerNormWeights);
1502 
1503  auto fbQLstmLayer = serializer::CreateQLstmLayer(
1504  m_flatBufferBuilder,
1505  fbQLstmBaseLayer,
1506  fbQLstmDescriptor,
1507  fbQLstmParams);
1508 
1509  CreateAnyLayer(fbQLstmLayer.o, serializer::Layer::Layer_QLstmLayer);
1510 }
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 1512 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().

1515 {
1516  IgnoreUnused(name);
1517 
1518  auto fbQuantizedLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_QuantizedLstm);
1519 
1520  // Get input parameters
1521  auto inputToInputWeights = CreateConstTensorInfo(params.GetInputToInputWeights());
1522  auto inputToForgetWeights = CreateConstTensorInfo(params.GetInputToForgetWeights());
1523  auto inputToCellWeights = CreateConstTensorInfo(params.GetInputToCellWeights());
1524  auto inputToOutputWeights = CreateConstTensorInfo(params.GetInputToOutputWeights());
1525 
1526  auto recurrentToInputWeights = CreateConstTensorInfo(params.GetRecurrentToInputWeights());
1527  auto recurrentToForgetWeights = CreateConstTensorInfo(params.GetRecurrentToForgetWeights());
1528  auto recurrentToCellWeights = CreateConstTensorInfo(params.GetRecurrentToCellWeights());
1529  auto recurrentToOutputWeights = CreateConstTensorInfo(params.GetRecurrentToOutputWeights());
1530 
1531  auto inputGateBias = CreateConstTensorInfo(params.GetInputGateBias());
1532  auto forgetGateBias = CreateConstTensorInfo(params.GetForgetGateBias());
1533  auto cellBias = CreateConstTensorInfo(params.GetCellBias());
1534  auto outputGateBias = CreateConstTensorInfo(params.GetOutputGateBias());
1535 
1536  auto fbQuantizedLstmParams = serializer::CreateQuantizedLstmInputParams(
1537  m_flatBufferBuilder,
1538  inputToInputWeights,
1539  inputToForgetWeights,
1540  inputToCellWeights,
1541  inputToOutputWeights,
1542  recurrentToInputWeights,
1543  recurrentToForgetWeights,
1544  recurrentToCellWeights,
1545  recurrentToOutputWeights,
1546  inputGateBias,
1547  forgetGateBias,
1548  cellBias,
1549  outputGateBias);
1550 
1551  auto fbQuantizedLstmLayer = serializer::CreateQuantizedLstmLayer(
1552  m_flatBufferBuilder,
1553  fbQuantizedLstmBaseLayer,
1554  fbQuantizedLstmParams);
1555 
1556  CreateAnyLayer(fbQuantizedLstmLayer.o, serializer::Layer::Layer_QuantizedLstmLayer);
1557 }
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 1045 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1046 {
1047  IgnoreUnused(name);
1048 
1049  auto fbQuantizeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Quantize);
1050  auto fbQuantizeLayer = serializer::CreateQuantizeLayer(m_flatBufferBuilder,
1051  fbQuantizeBaseLayer);
1052  CreateAnyLayer(fbQuantizeLayer.o, serializer::Layer::Layer_QuantizeLayer);
1053 }
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 869 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

871 {
872  IgnoreUnused(name);
873  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rank);
874  auto flatBufferRankLayer = serializer::CreateRankLayer(m_flatBufferBuilder, flatBufferBaseLayer);
875 
876  CreateAnyLayer(flatBufferRankLayer.o, serializer::Layer::Layer_RankLayer);
877 }
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 879 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

882 {
883  IgnoreUnused(name);
884 
885  // Create FlatBuffer BaseLayer
886  auto flatBufferReshapeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Reshape);
887 
888  std::vector<unsigned int> targetShape;
889  for (unsigned int i =0; i < reshapeDescriptor.m_TargetShape.GetNumDimensions(); i++)
890  {
891  targetShape.push_back(reshapeDescriptor.m_TargetShape[i]);
892  }
893 
894  auto flatBufferReshapeDesc = serializer::CreateReshapeDescriptor(m_flatBufferBuilder,
895  m_flatBufferBuilder.CreateVector(targetShape));
896 
897  // Create the FlatBuffer ReshapeLayer
898  auto flatBufferReshapeLayer = serializer::CreateReshapeLayer(m_flatBufferBuilder, flatBufferReshapeBaseLayer,
899  flatBufferReshapeDesc);
900 
901  // Add the AnyLayer to the FlatBufferLayers
902  CreateAnyLayer(flatBufferReshapeLayer.o, serializer::Layer::Layer_ReshapeLayer);
903 }
void IgnoreUnused(Ts &&...)
TensorShape m_TargetShape
Target shape value.
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174

◆ 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 905 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().

908 {
909  IgnoreUnused(name);
910 
911  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ResizeBilinear);
912 
913  auto flatBufferDescriptor =
914  CreateResizeBilinearDescriptor(m_flatBufferBuilder,
915  resizeDescriptor.m_TargetWidth,
916  resizeDescriptor.m_TargetHeight,
917  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
918  resizeDescriptor.m_AlignCorners,
919  resizeDescriptor.m_HalfPixelCenters);
920 
921  auto flatBufferLayer = serializer::CreateResizeBilinearLayer(m_flatBufferBuilder,
922  flatBufferBaseLayer,
923  flatBufferDescriptor);
924 
925  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeBilinearLayer);
926 }
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 928 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().

931 {
932  IgnoreUnused(name);
933 
934  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Resize);
935 
936  auto flatBufferDescriptor =
937  CreateResizeDescriptor(m_flatBufferBuilder,
938  resizeDescriptor.m_TargetHeight,
939  resizeDescriptor.m_TargetWidth,
940  GetFlatBufferResizeMethod(resizeDescriptor.m_Method),
941  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
942  resizeDescriptor.m_AlignCorners,
943  resizeDescriptor.m_HalfPixelCenters);
944 
945  auto flatBufferLayer = serializer::CreateResizeLayer(m_flatBufferBuilder,
946  flatBufferBaseLayer,
947  flatBufferDescriptor);
948 
949  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeLayer);
950 }
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 952 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

953 {
954  IgnoreUnused(name);
955 
956  auto fbRsqrtBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rsqrt);
957  auto fbRsqrtLayer = serializer::CreateRsqrtLayer(m_flatBufferBuilder, fbRsqrtBaseLayer);
958 
959  CreateAnyLayer(fbRsqrtLayer.o, serializer::Layer::Layer_RsqrtLayer);
960 }
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 962 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

965 {
966  IgnoreUnused(name);
967 
968  auto fbSliceBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Slice);
969  auto fbSliceDescriptor = CreateSliceDescriptor(m_flatBufferBuilder,
970  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Begin),
971  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Size));
972 
973  auto fbSliceLayer = serializer::CreateSliceLayer(m_flatBufferBuilder, fbSliceBaseLayer, fbSliceDescriptor);
974 
975  CreateAnyLayer(fbSliceLayer.o, serializer::Layer::Layer_SliceLayer);
976 }
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 979 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

982 {
983  IgnoreUnused(name);
984 
985  // Create FlatBuffer BaseLayer
986  auto flatBufferSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Softmax);
987 
988  // Create the FlatBuffer SoftmaxDescriptor
989  auto flatBufferSoftmaxDesc =
990  serializer::CreateSoftmaxDescriptor(m_flatBufferBuilder, softmaxDescriptor.m_Beta);
991 
992  // Create the FlatBuffer SoftmaxLayer
993  auto flatBufferSoftmaxLayer =
994  serializer::CreateSoftmaxLayer(m_flatBufferBuilder,
995  flatBufferSoftmaxBaseLayer,
996  flatBufferSoftmaxDesc);
997 
998  CreateAnyLayer(flatBufferSoftmaxLayer.o, serializer::Layer::Layer_SoftmaxLayer);
999 }
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 1095 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1098 {
1099  IgnoreUnused(name);
1100 
1101  // Create FlatBuffer BaseLayer
1102  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToBatchNd);
1103 
1104  std::vector<unsigned int> padList;
1105  padList.reserve(spaceToBatchNdDescriptor.m_PadList.size()*2);
1106  for (auto& pad : spaceToBatchNdDescriptor.m_PadList)
1107  {
1108  padList.push_back(pad.first);
1109  padList.push_back(pad.second);
1110  }
1111 
1112  auto flatBufferDescriptor =
1113  CreateSpaceToBatchNdDescriptor(m_flatBufferBuilder,
1114  m_flatBufferBuilder.CreateVector(spaceToBatchNdDescriptor.m_BlockShape),
1115  m_flatBufferBuilder.CreateVector(padList),
1116  GetFlatBufferDataLayout(spaceToBatchNdDescriptor.m_DataLayout));
1117 
1118  auto flatBufferLayer = serializer::CreateSpaceToBatchNdLayer(m_flatBufferBuilder,
1119  flatBufferBaseLayer,
1120  flatBufferDescriptor);
1121 
1122  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToBatchNdLayer);
1123 }
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 1126 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1129 {
1130  IgnoreUnused(name);
1131 
1132  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToDepth);
1133  auto flatBufferDescriptor =
1134  CreateSpaceToDepthDescriptor(m_flatBufferBuilder,
1135  spaceToDepthDescriptor.m_BlockSize,
1136  GetFlatBufferDataLayout(spaceToDepthDescriptor.m_DataLayout));
1137 
1138  auto flatBufferLayer = serializer::CreateSpaceToDepthLayer(m_flatBufferBuilder,
1139  flatBufferBaseLayer,
1140  flatBufferDescriptor);
1141 
1142  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToDepthLayer);
1143 }
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 1146 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().

1149 {
1150  IgnoreUnused(name);
1151 
1152  // Create FlatBuffer ViewOrigins
1153  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewOrigins;
1154  flatBufferViewOrigins.reserve(viewsDescriptor.GetNumViews());
1155 
1156  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1157  {
1158  std::vector<uint32_t> viewOrigin;
1159  viewOrigin.reserve(viewsDescriptor.GetNumDimensions());
1160 
1161  // Copy vector
1162  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1163  {
1164  viewOrigin.push_back(viewsDescriptor.GetViewOrigin(vIdx)[dIdx]);
1165  }
1166 
1167  flatBufferViewOrigins.push_back(CreateUintVector(m_flatBufferBuilder,
1168  m_flatBufferBuilder.CreateVector(viewOrigin)));
1169  }
1170 
1171  // Create FlatBuffer OriginsDescriptor
1172  auto flatBufferOriginDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
1173  viewsDescriptor.GetOrigins().GetConcatAxis(),
1174  viewsDescriptor.GetOrigins().GetNumViews(),
1175  viewsDescriptor.GetOrigins().GetNumDimensions(),
1176  m_flatBufferBuilder.CreateVector(flatBufferViewOrigins));
1177 
1178  // Create FlatBuffer ViewOrigins
1179  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewSizes;
1180  flatBufferViewSizes.reserve(viewsDescriptor.GetNumViews());
1181 
1182  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1183  {
1184  std::vector<uint32_t> viewSize;
1185  viewSize.reserve(viewsDescriptor.GetNumDimensions());
1186 
1187  // Copy vector
1188  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1189  {
1190  viewSize.push_back(viewsDescriptor.GetViewSizes(vIdx)[dIdx]);
1191  }
1192 
1193  flatBufferViewSizes.push_back(CreateUintVector(m_flatBufferBuilder,
1194  m_flatBufferBuilder.CreateVector(viewSize)));
1195  }
1196 
1197  // Create FlatBuffer ViewsDescriptor
1198  auto flatBufferViewsDescriptor = CreateViewsDescriptor(m_flatBufferBuilder,
1199  flatBufferOriginDescriptor,
1200  m_flatBufferBuilder.CreateVector(flatBufferViewSizes));
1201 
1202  // Create FlatBuffer BaseLayer
1203  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Splitter);
1204 
1205  auto flatBufferSplitterLayer = serializer::CreateSplitterLayer(m_flatBufferBuilder,
1206  flatBufferBaseLayer,
1207  flatBufferViewsDescriptor);
1208 
1209  CreateAnyLayer(flatBufferSplitterLayer.o, serializer::Layer::Layer_SplitterLayer);
1210 }
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 1237 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1240 {
1241  IgnoreUnused(name);
1242 
1243  auto stackBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Stack);
1244 
1245  std::vector<unsigned int> inputShape;
1246  for (unsigned int i =0; i < stackDescriptor.m_InputShape.GetNumDimensions(); i++)
1247  {
1248  inputShape.push_back(stackDescriptor.m_InputShape[i]);
1249  }
1250 
1251  auto flatBufferStackDescriptor = CreateStackDescriptor(m_flatBufferBuilder,
1252  stackDescriptor.m_Axis,
1253  stackDescriptor.m_NumInputs,
1254  m_flatBufferBuilder.CreateVector(inputShape));
1255 
1256  auto stackLayer = serializer::CreateStackLayer(m_flatBufferBuilder, stackBaseLayer, flatBufferStackDescriptor);
1257  CreateAnyLayer(stackLayer.o, serializer::Layer::Layer_StackLayer);
1258 }
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:174

◆ 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 1260 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1263 {
1264  IgnoreUnused(name);
1265 
1266  auto fbDescriptor = serializer::CreateStandInDescriptor(m_flatBufferBuilder,
1267  standInDescriptor.m_NumInputs,
1268  standInDescriptor.m_NumOutputs);
1269 
1270  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StandIn);
1271  auto fbLayer = serializer::CreateStandInLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
1272 
1273  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_StandInLayer);
1274 }
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 1276 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().

1279 {
1280  IgnoreUnused(name);
1281 
1282  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StridedSlice);
1283 
1284  auto flatBufferDescriptor =
1285  CreateStridedSliceDescriptor(m_flatBufferBuilder,
1286  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Begin),
1287  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_End),
1288  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Stride),
1289  stridedSliceDescriptor.m_BeginMask,
1290  stridedSliceDescriptor.m_EndMask,
1291  stridedSliceDescriptor.m_ShrinkAxisMask,
1292  stridedSliceDescriptor.m_EllipsisMask,
1293  stridedSliceDescriptor.m_NewAxisMask,
1294  GetFlatBufferDataLayout(stridedSliceDescriptor.m_DataLayout));
1295 
1296  auto flatBufferLayer = serializer::CreateStridedSliceLayer(m_flatBufferBuilder,
1297  flatBufferBaseLayer,
1298  flatBufferDescriptor);
1299 
1300  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_StridedSliceLayer);
1301 }
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 1303 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1304 {
1305  IgnoreUnused(name);
1306 
1307  auto fbSubtractionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Subtraction);
1308  auto fbSubtractionLayer = serializer::CreateSubtractionLayer(m_flatBufferBuilder, fbSubtractionBaseLayer);
1309 
1310  CreateAnyLayer(fbSubtractionLayer.o, serializer::Layer::Layer_SubtractionLayer);
1311 }
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 1313 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1314 {
1315  IgnoreUnused(name);
1316 
1317  auto fbSwitchBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Switch);
1318  auto fbSwitchLayer = serializer::CreateSwitchLayer(m_flatBufferBuilder, fbSwitchBaseLayer);
1319 
1320  CreateAnyLayer(fbSwitchLayer.o, serializer::Layer::Layer_SwitchLayer);
1321 }
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 1323 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().

1329 {
1330  IgnoreUnused(name);
1331 
1332  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Convolution2d);
1333  auto fbDescriptor = CreateTransposeConvolution2dDescriptor(m_flatBufferBuilder,
1334  descriptor.m_PadLeft,
1335  descriptor.m_PadRight,
1336  descriptor.m_PadTop,
1337  descriptor.m_PadBottom,
1338  descriptor.m_StrideX,
1339  descriptor.m_StrideY,
1340  descriptor.m_BiasEnabled,
1342 
1343  // weights & biases
1344  auto fbWeightsConstTensorInfo = CreateConstTensorInfo(weights);
1345  flatbuffers::Offset<serializer::ConstTensor> fbBiasesConstTensorInfo;
1346  if (biases.has_value())
1347  {
1348  fbBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
1349  }
1350 
1351  auto fbLayer = CreateTransposeConvolution2dLayer(m_flatBufferBuilder,
1352  fbBaseLayer,
1353  fbDescriptor,
1354  fbWeightsConstTensorInfo,
1355  fbBiasesConstTensorInfo);
1356 
1357  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_TransposeConvolution2dLayer);
1358 }
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 1360 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1363 {
1364  IgnoreUnused(name);
1365 
1366  // Create FlatBuffer BaseLayer
1367  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Transpose);
1368 
1369  std::vector<unsigned int> dimMappings;
1370  for (unsigned int i=0; i<descriptor.m_DimMappings.GetSize(); ++i)
1371  {
1372  dimMappings.push_back(descriptor.m_DimMappings[i]);
1373  }
1374 
1375  auto flatBufferDesc = serializer::CreateTransposeDescriptor(m_flatBufferBuilder,
1376  m_flatBufferBuilder.CreateVector(dimMappings));
1377 
1378  // Create the FlatBuffer TransposeLayer
1379  auto flatBufferLayer = serializer::CreateTransposeLayer(m_flatBufferBuilder,
1380  flatBufferBaseLayer,
1381  flatBufferDesc);
1382 
1383  // Add the AnyLayer to the FlatBufferLayers
1384  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_TransposeLayer);
1385 }
void IgnoreUnused(Ts &&...)

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