ArmNN
 20.02
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 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 VisitGreaterLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Greater layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInputLayer (const armnn::IConnectableLayer *layer, armnn::LayerBindingId id, const char *name=nullptr) override
 Function that an InputLayer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitInstanceNormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::InstanceNormalizationDescriptor &instanceNormalizationDescriptor, const char *name=nullptr) override
 Function that an instance normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitL2NormalizationLayer (const armnn::IConnectableLayer *layer, const armnn::L2NormalizationDescriptor &l2NormalizationDescriptor, const char *name=nullptr) override
 Function that an L2 normalization layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLogSoftmaxLayer (const armnn::IConnectableLayer *layer, const armnn::LogSoftmaxDescriptor &logSoftmaxDescriptor, const char *name=nullptr) override
 Function that a log softmax layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitLstmLayer (const armnn::IConnectableLayer *layer, const armnn::LstmDescriptor &descriptor, const armnn::LstmInputParams &params, const char *name=nullptr) override
 Function an Lstm layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMeanLayer (const armnn::IConnectableLayer *layer, const armnn::MeanDescriptor &descriptor, const char *name) override
 Function a Mean layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMinimumLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Minimum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMaximumLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a Maximum layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergeLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a merge layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMergerLayer (const armnn::IConnectableLayer *layer, const armnn::MergerDescriptor &mergerDescriptor, const char *name=nullptr) override
 Function that a merger layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitMultiplicationLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a multiplication layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitOutputLayer (const armnn::IConnectableLayer *layer, armnn::LayerBindingId id, const char *name=nullptr) override
 Function an output layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPadLayer (const armnn::IConnectableLayer *layer, const armnn::PadDescriptor &PadDescriptor, const char *name=nullptr) override
 Function a pad layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPermuteLayer (const armnn::IConnectableLayer *layer, const armnn::PermuteDescriptor &PermuteDescriptor, const char *name=nullptr) override
 Function that a permute layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPooling2dLayer (const armnn::IConnectableLayer *layer, const armnn::Pooling2dDescriptor &pooling2dDescriptor, const char *name=nullptr) override
 Function that a pooling layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitPreluLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function that a PReLU activation layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void VisitQuantizeLayer (const armnn::IConnectableLayer *layer, const char *name=nullptr) override
 Function a quantize layer should call back to when its Accept(ILayerVisitor&) function is invoked. More...
 
void 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 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::VisitFloorLayer(), SerializerVisitor::VisitFullyConnectedLayer(), SerializerVisitor::VisitGatherLayer(), SerializerVisitor::VisitGreaterLayer(), SerializerVisitor::VisitInputLayer(), SerializerVisitor::VisitInstanceNormalizationLayer(), SerializerVisitor::VisitL2NormalizationLayer(), SerializerVisitor::VisitLogSoftmaxLayer(), SerializerVisitor::VisitLstmLayer(), SerializerVisitor::VisitMaximumLayer(), SerializerVisitor::VisitMeanLayer(), SerializerVisitor::VisitMergeLayer(), SerializerVisitor::VisitMergerLayer(), SerializerVisitor::VisitMinimumLayer(), SerializerVisitor::VisitMultiplicationLayer(), SerializerVisitor::VisitNormalizationLayer(), SerializerVisitor::VisitOutputLayer(), SerializerVisitor::VisitPadLayer(), SerializerVisitor::VisitPermuteLayer(), SerializerVisitor::VisitPooling2dLayer(), SerializerVisitor::VisitPreluLayer(), SerializerVisitor::VisitQuantizedLstmLayer(), SerializerVisitor::VisitQuantizeLayer(), 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 1483 of file Serializer.cpp.

References IOutputSlot::CalculateIndexOnOwner(), IInputSlot::GetConnection(), TensorInfo::GetDataType(), armnnSerializer::GetFlatBufferDataType(), IConnectableLayer::GetInputSlot(), TensorShape::GetNumDimensions(), IConnectableLayer::GetNumInputSlots(), IConnectableLayer::GetNumOutputSlots(), IConnectableLayer::GetOutputSlot(), IOutputSlot::GetOwningLayerGuid(), TensorInfo::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), TensorInfo::GetShape(), and IOutputSlot::GetTensorInfo().

Referenced by SerializerVisitor::GetSerializedLayers().

1484 {
1485  flatbuffers::Offset<armnnSerializer::FeatureCompatibilityVersions> versionsTable =
1486  serializer::CreateFeatureCompatibilityVersions(
1487  m_flatBufferBuilder,
1488  1 // Binding ids scheme version
1489  );
1490  return versionsTable;
1491 }

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

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

130 {
131  IgnoreUnused(name);
132  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Abs);
133  auto flatBufferAbsLayer = serializer::CreateAbsLayer(m_flatBufferBuilder, flatBufferBaseLayer);
134 
135  CreateAnyLayer(flatBufferAbsLayer.o, serializer::Layer::Layer_AbsLayer);
136 }
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 139 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

142 {
143  IgnoreUnused(name);
144 
145  // Create FlatBuffer BaseLayer
146  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Activation);
147 
148  // Create the FlatBuffer ActivationDescriptor
149  auto flatBufferDescriptor = CreateActivationDescriptor(m_flatBufferBuilder,
150  GetFlatBufferActivationFunction(descriptor.m_Function),
151  descriptor.m_A,
152  descriptor.m_B);
153 
154  // Create the FlatBuffer ActivationLayer
155  auto flatBufferAdditionLayer = CreateActivationLayer(m_flatBufferBuilder,
156  flatBufferBaseLayer,
157  flatBufferDescriptor);
158 
159  // Add the AnyLayer to the FlatBufferLayers
160  CreateAnyLayer(flatBufferAdditionLayer.o, serializer::Layer::Layer_ActivationLayer);
161 }
serializer::ActivationFunction GetFlatBufferActivationFunction(armnn::ActivationFunction function)
Definition: Serializer.cpp:27
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 164 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

165 {
166  IgnoreUnused(name);
167 
168  // Create FlatBuffer BaseLayer
169  auto flatBufferAdditionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Addition);
170 
171  // Create the FlatBuffer AdditionLayer
172  auto flatBufferAdditionLayer = serializer::CreateAdditionLayer(m_flatBufferBuilder, flatBufferAdditionBaseLayer);
173 
174  // Add the AnyLayer to the FlatBufferLayers
175  CreateAnyLayer(flatBufferAdditionLayer.o, serializer::Layer::Layer_AdditionLayer);
176 }
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 179 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

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

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

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

Referenced by SerializerVisitor::GetSerializedLayers().

239 {
240  IgnoreUnused(name);
241 
242  auto fbBatchNormalizationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_BatchNormalization);
243  auto fbBatchNormalizationDescriptor = serializer::CreateBatchNormalizationDescriptor(
244  m_flatBufferBuilder,
245  batchNormDescriptor.m_Eps,
246  GetFlatBufferDataLayout(batchNormDescriptor.m_DataLayout));
247 
248  auto fbMeanConstTensorInfo = CreateConstTensorInfo(mean);
249  auto fbVarianceConstTensorInfo = CreateConstTensorInfo(variance);
250  auto fbBetaConstTensorInfo = CreateConstTensorInfo(beta);
251  auto fbGammaConstTensorInfo = CreateConstTensorInfo(gamma);
252  auto fbBatchNormalizationLayer = serializer::CreateBatchNormalizationLayer(m_flatBufferBuilder,
253  fbBatchNormalizationBaseLayer,
254  fbBatchNormalizationDescriptor,
255  fbMeanConstTensorInfo,
256  fbVarianceConstTensorInfo,
257  fbBetaConstTensorInfo,
258  fbGammaConstTensorInfo);
259 
260  CreateAnyLayer(fbBatchNormalizationLayer.o, serializer::Layer::Layer_BatchNormalizationLayer);
261 }
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 202 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

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

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

Referenced by SerializerVisitor::GetSerializedLayers().

266 {
267  IgnoreUnused(name);
268 
269  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Comparison);
270  auto fbDescriptor = serializer::CreateComparisonDescriptor(
271  m_flatBufferBuilder,
272  GetFlatBufferComparisonOperation(descriptor.m_Operation));
273 
274  auto fbLayer = serializer::CreateComparisonLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
275  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_ComparisonLayer);
276 }
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 729 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

732 {
733  IgnoreUnused(name);
734 
735  auto flatBufferConcatBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Concat);
736 
737  std::vector<flatbuffers::Offset<UintVector>> views;
738  for (unsigned int v = 0; v < concatDescriptor.GetNumViews(); ++v)
739  {
740  const uint32_t* origin = concatDescriptor.GetViewOrigin(v);
741  std::vector<uint32_t> origins;
742  for (unsigned int d = 0; d < concatDescriptor.GetNumDimensions(); ++d)
743  {
744  origins.push_back(origin[d]);
745  }
746  auto view = m_flatBufferBuilder.CreateVector(origins);
747  auto uintVector = CreateUintVector(m_flatBufferBuilder, view);
748  views.push_back(uintVector);
749  }
750 
751  auto flatBufferConcatDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
752  concatDescriptor.GetConcatAxis(),
753  concatDescriptor.GetNumViews(),
754  concatDescriptor.GetNumDimensions(),
755  m_flatBufferBuilder.CreateVector(views));
756 
757  auto flatBufferLayer = CreateConcatLayer(m_flatBufferBuilder,
758  flatBufferConcatBaseLayer,
759  flatBufferConcatDescriptor);
760 
761  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ConcatLayer);
762 }
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 279 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

282 {
283  IgnoreUnused(name);
284 
285  // Create FlatBuffer BaseLayer
286  auto flatBufferConstantBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Constant);
287 
288  auto flatBufferConstTensorInfo = CreateConstTensorInfo(input);
289 
290  // Create the FlatBuffer ConstantLayer
291  auto flatBufferLayer = CreateConstantLayer(m_flatBufferBuilder,
292  flatBufferConstantBaseLayer,
293  flatBufferConstTensorInfo);
294 
295  // Add the AnyLayer to the FlatBufferLayers
296  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ConstantLayer);
297 }
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 300 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().

305 {
306  IgnoreUnused(name);
307 
308  // Create FlatBuffer BaseLayer
309  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Convolution2d);
310 
311  auto flatBufferDescriptor = CreateConvolution2dDescriptor(m_flatBufferBuilder,
312  descriptor.m_PadLeft,
313  descriptor.m_PadRight,
314  descriptor.m_PadTop,
315  descriptor.m_PadBottom,
316  descriptor.m_StrideX,
317  descriptor.m_StrideY,
318  descriptor.m_DilationX,
319  descriptor.m_DilationY,
320  descriptor.m_BiasEnabled,
321  GetFlatBufferDataLayout(descriptor.m_DataLayout));
322  auto flatBufferWeightsConstTensorInfo = CreateConstTensorInfo(weights);
323  flatbuffers::Offset<serializer::ConstTensor> flatBufferBiasesConstTensorInfo;
324 
325  if (biases.has_value())
326  {
327  flatBufferBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
328  }
329 
330  // Create the FlatBuffer Convolution2dLayer
331  auto flatBufferLayer = CreateConvolution2dLayer(m_flatBufferBuilder,
332  flatBufferBaseLayer,
333  flatBufferDescriptor,
334  flatBufferWeightsConstTensorInfo,
335  flatBufferBiasesConstTensorInfo);
336 
337  // Add the AnyLayer to the FlatBufferLayers
338  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_Convolution2dLayer);
339 }
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 341 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

344 {
345  IgnoreUnused(name);
346 
347  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DepthToSpace);
348  auto fbDescriptor = CreateDepthToSpaceDescriptor(m_flatBufferBuilder,
349  descriptor.m_BlockSize,
350  GetFlatBufferDataLayout(descriptor.m_DataLayout));
351 
352  auto fbLayer = serializer::CreateDepthToSpaceLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
353 
354  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_DepthToSpaceLayer);
355 }
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 357 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().

362 {
363  IgnoreUnused(name);
364 
365  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DepthwiseConvolution2d);
366  auto fbDescriptor = CreateDepthwiseConvolution2dDescriptor(m_flatBufferBuilder,
367  descriptor.m_PadLeft,
368  descriptor.m_PadRight,
369  descriptor.m_PadTop,
370  descriptor.m_PadBottom,
371  descriptor.m_StrideX,
372  descriptor.m_StrideY,
373  descriptor.m_DilationX,
374  descriptor.m_DilationY,
375  descriptor.m_BiasEnabled,
376  GetFlatBufferDataLayout(descriptor.m_DataLayout));
377 
378  flatbuffers::Offset<serializer::ConstTensor> fbWeightsConstTensorInfo = CreateConstTensorInfo(weights);
379  flatbuffers::Offset<serializer::ConstTensor> fbBiasesConstTensorInfo;
380  if (biases.has_value())
381  {
382  fbBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
383  }
384 
385  auto flatBufferLayer = CreateDepthwiseConvolution2dLayer(m_flatBufferBuilder,
386  fbBaseLayer,
387  fbDescriptor,
388  fbWeightsConstTensorInfo,
389  fbBiasesConstTensorInfo);
390 
391  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_DepthwiseConvolution2dLayer);
392 }
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 394 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

396 {
397  IgnoreUnused(name);
398 
399  auto fbDequantizeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Dequantize);
400  auto fbDequantizeLayer = serializer::CreateDequantizeLayer(m_flatBufferBuilder, fbDequantizeBaseLayer);
401 
402  CreateAnyLayer(fbDequantizeLayer.o, serializer::Layer::Layer_DequantizeLayer);
403 }
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 405 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().

409 {
410  IgnoreUnused(name);
411 
412  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_DetectionPostProcess);
413  auto fbDescriptor = CreateDetectionPostProcessDescriptor(m_flatBufferBuilder,
414  descriptor.m_MaxDetections,
415  descriptor.m_MaxClassesPerDetection,
416  descriptor.m_DetectionsPerClass,
417  descriptor.m_NmsScoreThreshold,
418  descriptor.m_NmsIouThreshold,
419  descriptor.m_NumClasses,
420  descriptor.m_UseRegularNms,
421  descriptor.m_ScaleX,
422  descriptor.m_ScaleY,
423  descriptor.m_ScaleW,
424  descriptor.m_ScaleH);
425 
426  flatbuffers::Offset<serializer::ConstTensor> fbAnchorsConstTensorInfo = CreateConstTensorInfo(anchors);
427 
428  auto flatBufferLayer = CreateDetectionPostProcessLayer(m_flatBufferBuilder,
429  fbBaseLayer,
430  fbDescriptor,
431  fbAnchorsConstTensorInfo);
432 
433  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_DetectionPostProcessLayer);
434 }
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 436 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

437 {
438  IgnoreUnused(name);
439 
440  auto fbDivisionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Division);
441  auto fbDivisionLayer = serializer::CreateDivisionLayer(m_flatBufferBuilder, fbDivisionBaseLayer);
442 
443  CreateAnyLayer(fbDivisionLayer.o, serializer::Layer::Layer_DivisionLayer);
444 }
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 446 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

449 {
450  IgnoreUnused(name);
451 
452  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ElementwiseUnary);
453  auto fbDescriptor = serializer::CreateElementwiseUnaryDescriptor(
454  m_flatBufferBuilder,
455  GetFlatBufferUnaryOperation(descriptor.m_Operation));
456 
457  auto fbLayer = serializer::CreateElementwiseUnaryLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
458  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_ElementwiseUnaryLayer);
459 }
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 461 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

462 {
463  IgnoreUnused(name);
464 
465  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Equal);
466  auto fbEqualLayer = serializer::CreateEqualLayer(m_flatBufferBuilder, fbBaseLayer);
467 
468  CreateAnyLayer(fbEqualLayer.o, serializer::Layer::Layer_EqualLayer);
469 }
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 471 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

472 {
473  IgnoreUnused(name);
474 
475  auto flatBufferFloorBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Floor);
476  auto flatBufferFloorLayer = serializer::CreateFloorLayer(m_flatBufferBuilder, flatBufferFloorBaseLayer);
477 
478  CreateAnyLayer(flatBufferFloorLayer.o, serializer::Layer::Layer_FloorLayer);
479 }
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 1002 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1007 {
1008  IgnoreUnused(name);
1009 
1010  // Create FlatBuffer BaseLayer
1011  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_FullyConnected);
1012 
1013  // Create FlatBuffer FullyConnectedDescriptor
1014  auto flatBufferDescriptor =
1015  serializer::CreateFullyConnectedDescriptor(m_flatBufferBuilder,
1016  fullyConnectedDescriptor.m_BiasEnabled,
1017  fullyConnectedDescriptor.m_TransposeWeightMatrix);
1018 
1019  // Create FlatBuffer weights data
1020  auto flatBufferWeights = CreateConstTensorInfo(weights);
1021 
1022  // Create FlatBuffer bias data
1023  flatbuffers::Offset<serializer::ConstTensor> flatBufferBiases;
1024  if (fullyConnectedDescriptor.m_BiasEnabled)
1025  {
1026  flatBufferBiases = CreateConstTensorInfo(biases.value());
1027  }
1028 
1029  // Create FlatBuffer FullyConnectedLayer
1030  auto flatBufferLayer = serializer::CreateFullyConnectedLayer(m_flatBufferBuilder,
1031  flatBufferBaseLayer,
1032  flatBufferDescriptor,
1033  flatBufferWeights,
1034  flatBufferBiases);
1035 
1036  // Add created FullyConnectedLayer to the FlatBufferLayers
1037  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_FullyConnectedLayer);
1038 }
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
void IgnoreUnused(Ts &&...)
bool m_BiasEnabled
Enable/disable bias.

◆ VisitGatherLayer()

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

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

482 {
483  IgnoreUnused(name);
484 
485  auto fbGatherBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Gather);
486  auto flatBufferLayer = serializer::CreateGatherLayer(m_flatBufferBuilder, fbGatherBaseLayer);
487 
488  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_GatherLayer);
489 }
void IgnoreUnused(Ts &&...)

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

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

492 {
493  IgnoreUnused(name);
494 
495  auto fbGreaterBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Greater);
496  auto fbGreaterLayer = serializer::CreateGreaterLayer(m_flatBufferBuilder, fbGreaterBaseLayer);
497 
498  CreateAnyLayer(fbGreaterLayer.o, serializer::Layer::Layer_GreaterLayer);
499 }
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 87 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

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

505 {
506  IgnoreUnused(name);
507 
508  auto fbDescriptor = serializer::CreateInstanceNormalizationDescriptor(
509  m_flatBufferBuilder,
510  instanceNormalizationDescriptor.m_Gamma,
511  instanceNormalizationDescriptor.m_Beta,
512  instanceNormalizationDescriptor.m_Eps,
513  GetFlatBufferDataLayout(instanceNormalizationDescriptor.m_DataLayout));
514 
515  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_InstanceNormalization);
516  auto fbLayer = serializer::CreateInstanceNormalizationLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
517 
518  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_InstanceNormalizationLayer);
519 }
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 521 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

524 {
525  IgnoreUnused(name);
526 
527  // Create FlatBuffer BaseLayer
528  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_L2Normalization);
529 
530  // Create the FlatBuffer L2Normalization Descriptor
531  auto fbDescriptor = serializer::CreateL2NormalizationDescriptor(
532  m_flatBufferBuilder,
533  GetFlatBufferDataLayout(l2NormalizationDescriptor.m_DataLayout),
534  l2NormalizationDescriptor.m_Eps);
535 
536  // Create FlatBuffer layer
537  auto fbLayer = serializer::CreateL2NormalizationLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
538 
539  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_L2NormalizationLayer);
540 }
void IgnoreUnused(Ts &&...)
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)

◆ VisitLogSoftmaxLayer()

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

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

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

Implements ILayerVisitor.

Definition at line 542 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

545 {
546  IgnoreUnused(name);
547 
548  // Create FlatBuffer BaseLayer
549  auto flatBufferLogSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_LogSoftmax);
550 
551  // Create the FlatBuffer LogSoftmaxDescriptor
552  auto flatBufferLogSoftmaxDesc =
553  serializer::CreateLogSoftmaxDescriptor(m_flatBufferBuilder,
554  logSoftmaxDescriptor.m_Beta,
555  logSoftmaxDescriptor.m_Axis);
556 
557  // Create the FlatBuffer LogSoftmaxLayer
558  auto flatBufferLogSoftmaxLayer =
559  serializer::CreateLogSoftmaxLayer(m_flatBufferBuilder,
560  flatBufferLogSoftmaxBaseLayer,
561  flatBufferLogSoftmaxDesc);
562 
563  CreateAnyLayer(flatBufferLogSoftmaxLayer.o, serializer::Layer::Layer_LogSoftmaxLayer);
564 }
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 566 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().

570 {
571  IgnoreUnused(name);
572 
573  auto fbLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Lstm);
574 
575  auto fbLstmDescriptor = serializer::CreateLstmDescriptor(
576  m_flatBufferBuilder,
577  descriptor.m_ActivationFunc,
578  descriptor.m_ClippingThresCell,
579  descriptor.m_ClippingThresProj,
580  descriptor.m_CifgEnabled,
581  descriptor.m_PeepholeEnabled,
582  descriptor.m_ProjectionEnabled,
583  descriptor.m_LayerNormEnabled);
584 
585  // Get mandatory input parameters
586  auto inputToForgetWeights = CreateConstTensorInfo(*params.m_InputToForgetWeights);
587  auto inputToCellWeights = CreateConstTensorInfo(*params.m_InputToCellWeights);
588  auto inputToOutputWeights = CreateConstTensorInfo(*params.m_InputToOutputWeights);
589  auto recurrentToForgetWeights = CreateConstTensorInfo(*params.m_RecurrentToForgetWeights);
590  auto recurrentToCellWeights = CreateConstTensorInfo(*params.m_RecurrentToCellWeights);
591  auto recurrentToOutputWeights = CreateConstTensorInfo(*params.m_RecurrentToOutputWeights);
592  auto forgetGateBias = CreateConstTensorInfo(*params.m_ForgetGateBias);
593  auto cellBias = CreateConstTensorInfo(*params.m_CellBias);
594  auto outputGateBias = CreateConstTensorInfo(*params.m_OutputGateBias);
595 
596  //Define optional parameters, these will be set depending on configuration in Lstm descriptor
597  flatbuffers::Offset<serializer::ConstTensor> inputToInputWeights;
598  flatbuffers::Offset<serializer::ConstTensor> recurrentToInputWeights;
599  flatbuffers::Offset<serializer::ConstTensor> cellToInputWeights;
600  flatbuffers::Offset<serializer::ConstTensor> inputGateBias;
601  flatbuffers::Offset<serializer::ConstTensor> projectionWeights;
602  flatbuffers::Offset<serializer::ConstTensor> projectionBias;
603  flatbuffers::Offset<serializer::ConstTensor> cellToForgetWeights;
604  flatbuffers::Offset<serializer::ConstTensor> cellToOutputWeights;
605  flatbuffers::Offset<serializer::ConstTensor> inputLayerNormWeights;
606  flatbuffers::Offset<serializer::ConstTensor> forgetLayerNormWeights;
607  flatbuffers::Offset<serializer::ConstTensor> cellLayerNormWeights;
608  flatbuffers::Offset<serializer::ConstTensor> outputLayerNormWeights;
609 
610  if (!descriptor.m_CifgEnabled)
611  {
612  inputToInputWeights = CreateConstTensorInfo(*params.m_InputToInputWeights);
613  recurrentToInputWeights = CreateConstTensorInfo(*params.m_RecurrentToInputWeights);
614  cellToInputWeights = CreateConstTensorInfo(*params.m_CellToInputWeights);
615  inputGateBias = CreateConstTensorInfo(*params.m_InputGateBias);
616  }
617 
618  if (descriptor.m_ProjectionEnabled)
619  {
620  projectionWeights = CreateConstTensorInfo(*params.m_ProjectionWeights);
621  projectionBias = CreateConstTensorInfo(*params.m_ProjectionBias);
622  }
623 
624  if (descriptor.m_PeepholeEnabled)
625  {
626  cellToForgetWeights = CreateConstTensorInfo(*params.m_CellToForgetWeights);
627  cellToOutputWeights = CreateConstTensorInfo(*params.m_CellToOutputWeights);
628  }
629 
630  if (descriptor.m_LayerNormEnabled)
631  {
632  if (!descriptor.m_CifgEnabled)
633  {
634  inputLayerNormWeights = CreateConstTensorInfo((*params.m_InputLayerNormWeights));
635  }
636  forgetLayerNormWeights = CreateConstTensorInfo(*params.m_ForgetLayerNormWeights);
637  cellLayerNormWeights = CreateConstTensorInfo(*params.m_CellLayerNormWeights);
638  outputLayerNormWeights = CreateConstTensorInfo(*params.m_OutputLayerNormWeights);
639  }
640 
641  auto fbLstmParams = serializer::CreateLstmInputParams(
642  m_flatBufferBuilder,
643  inputToForgetWeights,
644  inputToCellWeights,
645  inputToOutputWeights,
646  recurrentToForgetWeights,
647  recurrentToCellWeights,
648  recurrentToOutputWeights,
649  forgetGateBias,
650  cellBias,
651  outputGateBias,
652  inputToInputWeights,
653  recurrentToInputWeights,
654  cellToInputWeights,
655  inputGateBias,
656  projectionWeights,
657  projectionBias,
658  cellToForgetWeights,
659  cellToOutputWeights,
660  inputLayerNormWeights,
661  forgetLayerNormWeights,
662  cellLayerNormWeights,
663  outputLayerNormWeights);
664 
665  auto fbLstmLayer = serializer::CreateLstmLayer(
666  m_flatBufferBuilder,
667  fbLstmBaseLayer,
668  fbLstmDescriptor,
669  fbLstmParams);
670 
671  CreateAnyLayer(fbLstmLayer.o, serializer::Layer::Layer_LstmLayer);
672 }
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 674 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

675 {
676  IgnoreUnused(name);
677 
678  auto fbMaximumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Maximum);
679  auto fbMaximumLayer = serializer::CreateMaximumLayer(m_flatBufferBuilder, fbMaximumBaseLayer);
680 
681  CreateAnyLayer(fbMaximumLayer.o, serializer::Layer::Layer_MaximumLayer);
682 }
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 684 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

687 {
688  IgnoreUnused(name);
689 
690  auto fbMeanBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Mean);
691  auto fbMeanDescriptor = serializer::CreateMeanDescriptor(m_flatBufferBuilder,
692  m_flatBufferBuilder.CreateVector(descriptor.m_Axis),
693  descriptor.m_KeepDims);
694 
695  auto fbMeanLayer = serializer::CreateMeanLayer(m_flatBufferBuilder,
696  fbMeanBaseLayer,
697  fbMeanDescriptor);
698 
699  CreateAnyLayer(fbMeanLayer.o, serializer::Layer::Layer_MeanLayer);
700 }
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 712 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

713 {
714  IgnoreUnused(name);
715 
716  auto fbMergeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Merge);
717  auto fbMergeLayer = serializer::CreateMergeLayer(m_flatBufferBuilder, fbMergeBaseLayer);
718 
719  CreateAnyLayer(fbMergeLayer.o, serializer::Layer::Layer_MergeLayer);
720 }
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 722 of file Serializer.cpp.

Referenced by SerializerVisitor::GetSerializedLayers().

725 {
726  VisitConcatLayer(layer, mergerDescriptor, name);
727 }
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:729

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

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

703 {
704  IgnoreUnused(name);
705 
706  auto fbMinimumBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Minimum);
707  auto fbMinimumLayer = serializer::CreateMinimumLayer(m_flatBufferBuilder, fbMinimumBaseLayer);
708 
709  CreateAnyLayer(fbMinimumLayer.o, serializer::Layer::Layer_MinimumLayer);
710 }
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 764 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

765 {
766  IgnoreUnused(name);
767 
768  auto fbMultiplicationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Multiplication);
769  auto fbMultiplicationLayer = serializer::CreateMultiplicationLayer(m_flatBufferBuilder,
770  fbMultiplicationBaseLayer);
771 
772  CreateAnyLayer(fbMultiplicationLayer.o, serializer::Layer::Layer_MultiplicationLayer);
773 }
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 1158 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().

1161 {
1162  IgnoreUnused(name);
1163 
1164  auto fbNormalizationBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Normalization);
1165 
1166  auto fbNormalizationDescriptor = serializer::CreateNormalizationDescriptor(
1167  m_flatBufferBuilder,
1168  GetFlatBufferNormalizationAlgorithmChannel(descriptor.m_NormChannelType),
1169  GetFlatBufferNormalizationAlgorithmMethod(descriptor.m_NormMethodType),
1170  descriptor.m_NormSize,
1171  descriptor.m_Alpha,
1172  descriptor.m_Beta,
1173  descriptor.m_K,
1174  GetFlatBufferDataLayout(descriptor.m_DataLayout));
1175 
1176  auto flatBufferLayer = serializer::CreateNormalizationLayer(m_flatBufferBuilder,
1177  fbNormalizationBaseLayer,
1178  fbNormalizationDescriptor);
1179 
1180  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_NormalizationLayer);
1181 }
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 109 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

110 {
111  IgnoreUnused(name);
112 
113  // Create FlatBuffer BaseLayer
114  auto flatBufferOutputBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Output);
115 
116  // Create FlatBuffer BindableBaseLayer
117  auto flatBufferOutputBindableBaseLayer = serializer::CreateBindableLayerBase(m_flatBufferBuilder,
118  flatBufferOutputBaseLayer,
119  id);
120  // Push layer binding id to outputIds.
121  m_outputIds.push_back(id);
122 
123  // Create the FlatBuffer OutputLayer
124  auto flatBufferOutputLayer = serializer::CreateOutputLayer(m_flatBufferBuilder, flatBufferOutputBindableBaseLayer);
125  // Add the AnyLayer to the FlatBufferLayers
126  CreateAnyLayer(flatBufferOutputLayer.o, serializer::Layer::Layer_OutputLayer);
127 }
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 775 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

778 {
779  IgnoreUnused(name);
780 
781  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pad);
782 
783  std::vector<unsigned int> padList;
784  for (auto& p: padDescriptor.m_PadList)
785  {
786  padList.push_back(p.first);
787  padList.push_back(p.second);
788  }
789 
790  auto flatBufferPadDesc = serializer::CreatePadDescriptor(m_flatBufferBuilder,
791  m_flatBufferBuilder.CreateVector(padList),
792  padDescriptor.m_PadValue);
793 
794  auto flatBufferPadLayer = serializer::CreatePadLayer(m_flatBufferBuilder,
795  flatBufferBaseLayer,
796  flatBufferPadDesc);
797 
798  CreateAnyLayer(flatBufferPadLayer.o, serializer::Layer::Layer_PadLayer);
799 }
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 801 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

804 {
805  IgnoreUnused(name);
806 
807  // Create FlatBuffer BaseLayer
808  auto flatBufferPermuteBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Permute);
809 
810  std::vector<unsigned int> dimMappings;
811  for (unsigned int i=0; i<permuteDescriptor.m_DimMappings.GetSize(); ++i)
812  {
813  dimMappings.push_back(permuteDescriptor.m_DimMappings[i]);
814  }
815 
816  auto flatBufferPermuteDesc = serializer::CreatePermuteDescriptor(m_flatBufferBuilder,
817  m_flatBufferBuilder.CreateVector(dimMappings));
818 
819  // Create the FlatBuffer PermuteLayer
820  auto flatBufferPermuteLayer = serializer::CreatePermuteLayer(m_flatBufferBuilder,
821  flatBufferPermuteBaseLayer,
822  flatBufferPermuteDesc);
823 
824  // Add the AnyLayer to the FlatBufferLayers
825  CreateAnyLayer(flatBufferPermuteLayer.o, serializer::Layer::Layer_PermuteLayer);
826 }
void IgnoreUnused(Ts &&...)
SizeType GetSize() const
Definition: Types.hpp:202
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 947 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().

950 {
951  IgnoreUnused(name);
952 
953  auto fbPooling2dBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Pooling2d);
954  auto fbPooling2dDescriptor = serializer::CreatePooling2dDescriptor(
955  m_flatBufferBuilder,
956  GetFlatBufferPoolingAlgorithm(pooling2dDescriptor.m_PoolType),
957  pooling2dDescriptor.m_PadLeft,
958  pooling2dDescriptor.m_PadRight,
959  pooling2dDescriptor.m_PadTop,
960  pooling2dDescriptor.m_PadBottom,
961  pooling2dDescriptor.m_PoolWidth,
962  pooling2dDescriptor.m_PoolHeight,
963  pooling2dDescriptor.m_StrideX,
964  pooling2dDescriptor.m_StrideY,
966  GetFlatBufferPaddingMethod(pooling2dDescriptor.m_PaddingMethod),
967  GetFlatBufferDataLayout(pooling2dDescriptor.m_DataLayout));
968 
969  auto fbPooling2dLayer = serializer::CreatePooling2dLayer(m_flatBufferBuilder,
970  fbPooling2dBaseLayer,
971  fbPooling2dDescriptor);
972 
973  CreateAnyLayer(fbPooling2dLayer.o, serializer::Layer::Layer_Pooling2dLayer);
974 }
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 976 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

978 {
979  IgnoreUnused(name);
980 
981  // Create FlatBuffer BaseLayer
982  auto flatBufferPreluBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Prelu);
983 
984  // Create the FlatBuffer AdditionLayer
985  auto flatBufferPreluLayer = serializer::CreatePreluLayer(m_flatBufferBuilder, flatBufferPreluBaseLayer);
986 
987  // Add the AnyLayer to the FlatBufferLayers
988  CreateAnyLayer(flatBufferPreluLayer.o, serializer::Layer::Layer_PreluLayer);
989 }
void IgnoreUnused(Ts &&...)

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

References armnn::Boolean, armnn::Float16, armnn::Float32, QuantizedLstmInputParams::GetCellBias(), TensorInfo::GetDataType(), 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::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), QuantizedLstmInputParams::GetRecurrentToCellWeights(), QuantizedLstmInputParams::GetRecurrentToForgetWeights(), QuantizedLstmInputParams::GetRecurrentToInputWeights(), QuantizedLstmInputParams::GetRecurrentToOutputWeights(), TensorInfo::GetShape(), armnn::IgnoreUnused(), armnn::QAsymmU8, armnn::QSymmS16, and armnn::Signed32.

Referenced by SerializerVisitor::GetSerializedLayers().

1336 {
1337  IgnoreUnused(name);
1338 
1339  auto fbQuantizedLstmBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_QuantizedLstm);
1340 
1341  // Get input parameters
1342  auto inputToInputWeights = CreateConstTensorInfo(params.GetInputToInputWeights());
1343  auto inputToForgetWeights = CreateConstTensorInfo(params.GetInputToForgetWeights());
1344  auto inputToCellWeights = CreateConstTensorInfo(params.GetInputToCellWeights());
1345  auto inputToOutputWeights = CreateConstTensorInfo(params.GetInputToOutputWeights());
1346 
1347  auto recurrentToInputWeights = CreateConstTensorInfo(params.GetRecurrentToInputWeights());
1348  auto recurrentToForgetWeights = CreateConstTensorInfo(params.GetRecurrentToForgetWeights());
1349  auto recurrentToCellWeights = CreateConstTensorInfo(params.GetRecurrentToCellWeights());
1350  auto recurrentToOutputWeights = CreateConstTensorInfo(params.GetRecurrentToOutputWeights());
1351 
1352  auto inputGateBias = CreateConstTensorInfo(params.GetInputGateBias());
1353  auto forgetGateBias = CreateConstTensorInfo(params.GetForgetGateBias());
1354  auto cellBias = CreateConstTensorInfo(params.GetCellBias());
1355  auto outputGateBias = CreateConstTensorInfo(params.GetOutputGateBias());
1356 
1357  auto fbQuantizedLstmParams = serializer::CreateQuantizedLstmInputParams(
1358  m_flatBufferBuilder,
1359  inputToInputWeights,
1360  inputToForgetWeights,
1361  inputToCellWeights,
1362  inputToOutputWeights,
1363  recurrentToInputWeights,
1364  recurrentToForgetWeights,
1365  recurrentToCellWeights,
1366  recurrentToOutputWeights,
1367  inputGateBias,
1368  forgetGateBias,
1369  cellBias,
1370  outputGateBias);
1371 
1372  auto fbQuantizedLstmLayer = serializer::CreateQuantizedLstmLayer(
1373  m_flatBufferBuilder,
1374  fbQuantizedLstmBaseLayer,
1375  fbQuantizedLstmParams);
1376 
1377  CreateAnyLayer(fbQuantizedLstmLayer.o, serializer::Layer::Layer_QuantizedLstmLayer);
1378 }
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 991 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

992 {
993  IgnoreUnused(name);
994 
995  auto fbQuantizeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Quantize);
996  auto fbQuantizeLayer = serializer::CreateQuantizeLayer(m_flatBufferBuilder,
997  fbQuantizeBaseLayer);
998  CreateAnyLayer(fbQuantizeLayer.o, serializer::Layer::Layer_QuantizeLayer);
999 }
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 829 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

832 {
833  IgnoreUnused(name);
834 
835  // Create FlatBuffer BaseLayer
836  auto flatBufferReshapeBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Reshape);
837 
838  std::vector<unsigned int> targetShape;
839  for (unsigned int i =0; i < reshapeDescriptor.m_TargetShape.GetNumDimensions(); i++)
840  {
841  targetShape.push_back(reshapeDescriptor.m_TargetShape[i]);
842  }
843 
844  auto flatBufferReshapeDesc = serializer::CreateReshapeDescriptor(m_flatBufferBuilder,
845  m_flatBufferBuilder.CreateVector(targetShape));
846 
847  // Create the FlatBuffer ReshapeLayer
848  auto flatBufferReshapeLayer = serializer::CreateReshapeLayer(m_flatBufferBuilder, flatBufferReshapeBaseLayer,
849  flatBufferReshapeDesc);
850 
851  // Add the AnyLayer to the FlatBufferLayers
852  CreateAnyLayer(flatBufferReshapeLayer.o, serializer::Layer::Layer_ReshapeLayer);
853 }
void IgnoreUnused(Ts &&...)
TensorShape m_TargetShape
Target shape value.
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:43

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

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

Referenced by SerializerVisitor::GetSerializedLayers().

858 {
859  IgnoreUnused(name);
860 
861  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_ResizeBilinear);
862 
863  auto flatBufferDescriptor =
864  CreateResizeBilinearDescriptor(m_flatBufferBuilder,
865  resizeDescriptor.m_TargetWidth,
866  resizeDescriptor.m_TargetHeight,
867  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout));
868 
869  auto flatBufferLayer = serializer::CreateResizeBilinearLayer(m_flatBufferBuilder,
870  flatBufferBaseLayer,
871  flatBufferDescriptor);
872 
873  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeBilinearLayer);
874 }
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 876 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

879 {
880  IgnoreUnused(name);
881 
882  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Resize);
883 
884  auto flatBufferDescriptor =
885  CreateResizeDescriptor(m_flatBufferBuilder,
886  resizeDescriptor.m_TargetHeight,
887  resizeDescriptor.m_TargetWidth,
888  GetFlatBufferResizeMethod(resizeDescriptor.m_Method),
889  GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout));
890 
891  auto flatBufferLayer = serializer::CreateResizeLayer(m_flatBufferBuilder,
892  flatBufferBaseLayer,
893  flatBufferDescriptor);
894 
895  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_ResizeLayer);
896 }
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
void IgnoreUnused(Ts &&...)
uint32_t m_TargetWidth
Target width value.
uint32_t m_TargetHeight
Target height value.
armnnSerializer::DataLayout GetFlatBufferDataLayout(armnn::DataLayout dataLayout)
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 898 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

899 {
900  IgnoreUnused(name);
901 
902  auto fbRsqrtBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Rsqrt);
903  auto fbRsqrtLayer = serializer::CreateRsqrtLayer(m_flatBufferBuilder, fbRsqrtBaseLayer);
904 
905  CreateAnyLayer(fbRsqrtLayer.o, serializer::Layer::Layer_RsqrtLayer);
906 }
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 908 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

911 {
912  IgnoreUnused(name);
913 
914  auto fbSliceBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Slice);
915  auto fbSliceDescriptor = CreateSliceDescriptor(m_flatBufferBuilder,
916  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Begin),
917  m_flatBufferBuilder.CreateVector(sliceDescriptor.m_Size));
918 
919  auto fbSliceLayer = serializer::CreateSliceLayer(m_flatBufferBuilder, fbSliceBaseLayer, fbSliceDescriptor);
920 
921  CreateAnyLayer(fbSliceLayer.o, serializer::Layer::Layer_SliceLayer);
922 }
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 925 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

928 {
929  IgnoreUnused(name);
930 
931  // Create FlatBuffer BaseLayer
932  auto flatBufferSoftmaxBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Softmax);
933 
934  // Create the FlatBuffer SoftmaxDescriptor
935  auto flatBufferSoftmaxDesc =
936  serializer::CreateSoftmaxDescriptor(m_flatBufferBuilder, softmaxDescriptor.m_Beta);
937 
938  // Create the FlatBuffer SoftmaxLayer
939  auto flatBufferSoftmaxLayer =
940  serializer::CreateSoftmaxLayer(m_flatBufferBuilder,
941  flatBufferSoftmaxBaseLayer,
942  flatBufferSoftmaxDesc);
943 
944  CreateAnyLayer(flatBufferSoftmaxLayer.o, serializer::Layer::Layer_SoftmaxLayer);
945 }
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 1041 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1044 {
1045  IgnoreUnused(name);
1046 
1047  // Create FlatBuffer BaseLayer
1048  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToBatchNd);
1049 
1050  std::vector<unsigned int> padList;
1051  padList.reserve(spaceToBatchNdDescriptor.m_PadList.size()*2);
1052  for (auto& pad : spaceToBatchNdDescriptor.m_PadList)
1053  {
1054  padList.push_back(pad.first);
1055  padList.push_back(pad.second);
1056  }
1057 
1058  auto flatBufferDescriptor =
1059  CreateSpaceToBatchNdDescriptor(m_flatBufferBuilder,
1060  m_flatBufferBuilder.CreateVector(spaceToBatchNdDescriptor.m_BlockShape),
1061  m_flatBufferBuilder.CreateVector(padList),
1062  GetFlatBufferDataLayout(spaceToBatchNdDescriptor.m_DataLayout));
1063 
1064  auto flatBufferLayer = serializer::CreateSpaceToBatchNdLayer(m_flatBufferBuilder,
1065  flatBufferBaseLayer,
1066  flatBufferDescriptor);
1067 
1068  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToBatchNdLayer);
1069 }
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 1072 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1075 {
1076  IgnoreUnused(name);
1077 
1078  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_SpaceToDepth);
1079  auto flatBufferDescriptor =
1080  CreateSpaceToDepthDescriptor(m_flatBufferBuilder,
1081  spaceToDepthDescriptor.m_BlockSize,
1082  GetFlatBufferDataLayout(spaceToDepthDescriptor.m_DataLayout));
1083 
1084  auto flatBufferLayer = serializer::CreateSpaceToDepthLayer(m_flatBufferBuilder,
1085  flatBufferBaseLayer,
1086  flatBufferDescriptor);
1087 
1088  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_SpaceToDepthLayer);
1089 }
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 1092 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().

1095 {
1096  IgnoreUnused(name);
1097 
1098  // Create FlatBuffer ViewOrigins
1099  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewOrigins;
1100  flatBufferViewOrigins.reserve(viewsDescriptor.GetNumViews());
1101 
1102  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1103  {
1104  std::vector<uint32_t> viewOrigin;
1105  viewOrigin.reserve(viewsDescriptor.GetNumDimensions());
1106 
1107  // Copy vector
1108  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1109  {
1110  viewOrigin.push_back(viewsDescriptor.GetViewOrigin(vIdx)[dIdx]);
1111  }
1112 
1113  flatBufferViewOrigins.push_back(CreateUintVector(m_flatBufferBuilder,
1114  m_flatBufferBuilder.CreateVector(viewOrigin)));
1115  }
1116 
1117  // Create FlatBuffer OriginsDescriptor
1118  auto flatBufferOriginDescriptor = CreateOriginsDescriptor(m_flatBufferBuilder,
1119  viewsDescriptor.GetOrigins().GetConcatAxis(),
1120  viewsDescriptor.GetOrigins().GetNumViews(),
1121  viewsDescriptor.GetOrigins().GetNumDimensions(),
1122  m_flatBufferBuilder.CreateVector(flatBufferViewOrigins));
1123 
1124  // Create FlatBuffer ViewOrigins
1125  std::vector<flatbuffers::Offset<UintVector>> flatBufferViewSizes;
1126  flatBufferViewSizes.reserve(viewsDescriptor.GetNumViews());
1127 
1128  for(unsigned int vIdx = 0; vIdx < viewsDescriptor.GetNumViews(); ++vIdx)
1129  {
1130  std::vector<uint32_t> viewSize;
1131  viewSize.reserve(viewsDescriptor.GetNumDimensions());
1132 
1133  // Copy vector
1134  for(unsigned int dIdx = 0; dIdx < viewsDescriptor.GetNumDimensions(); ++dIdx)
1135  {
1136  viewSize.push_back(viewsDescriptor.GetViewSizes(vIdx)[dIdx]);
1137  }
1138 
1139  flatBufferViewSizes.push_back(CreateUintVector(m_flatBufferBuilder,
1140  m_flatBufferBuilder.CreateVector(viewSize)));
1141  }
1142 
1143  // Create FlatBuffer ViewsDescriptor
1144  auto flatBufferViewsDescriptor = CreateViewsDescriptor(m_flatBufferBuilder,
1145  flatBufferOriginDescriptor,
1146  m_flatBufferBuilder.CreateVector(flatBufferViewSizes));
1147 
1148  // Create FlatBuffer BaseLayer
1149  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Splitter);
1150 
1151  auto flatBufferSplitterLayer = serializer::CreateSplitterLayer(m_flatBufferBuilder,
1152  flatBufferBaseLayer,
1153  flatBufferViewsDescriptor);
1154 
1155  CreateAnyLayer(flatBufferSplitterLayer.o, serializer::Layer::Layer_SplitterLayer);
1156 }
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 1183 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1186 {
1187  IgnoreUnused(name);
1188 
1189  auto stackBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Stack);
1190 
1191  std::vector<unsigned int> inputShape;
1192  for (unsigned int i =0; i < stackDescriptor.m_InputShape.GetNumDimensions(); i++)
1193  {
1194  inputShape.push_back(stackDescriptor.m_InputShape[i]);
1195  }
1196 
1197  auto flatBufferStackDescriptor = CreateStackDescriptor(m_flatBufferBuilder,
1198  stackDescriptor.m_Axis,
1199  stackDescriptor.m_NumInputs,
1200  m_flatBufferBuilder.CreateVector(inputShape));
1201 
1202  auto stackLayer = serializer::CreateStackLayer(m_flatBufferBuilder, stackBaseLayer, flatBufferStackDescriptor);
1203  CreateAnyLayer(stackLayer.o, serializer::Layer::Layer_StackLayer);
1204 }
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
Definition: Tensor.hpp:43

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

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

Referenced by SerializerVisitor::GetSerializedLayers().

1209 {
1210  IgnoreUnused(name);
1211 
1212  auto fbDescriptor = serializer::CreateStandInDescriptor(m_flatBufferBuilder,
1213  standInDescriptor.m_NumInputs,
1214  standInDescriptor.m_NumOutputs);
1215 
1216  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StandIn);
1217  auto fbLayer = serializer::CreateStandInLayer(m_flatBufferBuilder, fbBaseLayer, fbDescriptor);
1218 
1219  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_StandInLayer);
1220 }
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 1222 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().

1225 {
1226  IgnoreUnused(name);
1227 
1228  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_StridedSlice);
1229 
1230  auto flatBufferDescriptor =
1231  CreateStridedSliceDescriptor(m_flatBufferBuilder,
1232  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Begin),
1233  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_End),
1234  m_flatBufferBuilder.CreateVector(stridedSliceDescriptor.m_Stride),
1235  stridedSliceDescriptor.m_BeginMask,
1236  stridedSliceDescriptor.m_EndMask,
1237  stridedSliceDescriptor.m_ShrinkAxisMask,
1238  stridedSliceDescriptor.m_EllipsisMask,
1239  stridedSliceDescriptor.m_NewAxisMask,
1240  GetFlatBufferDataLayout(stridedSliceDescriptor.m_DataLayout));
1241 
1242  auto flatBufferLayer = serializer::CreateStridedSliceLayer(m_flatBufferBuilder,
1243  flatBufferBaseLayer,
1244  flatBufferDescriptor);
1245 
1246  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_StridedSliceLayer);
1247 }
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 1249 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1250 {
1251  IgnoreUnused(name);
1252 
1253  auto fbSubtractionBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Subtraction);
1254  auto fbSubtractionLayer = serializer::CreateSubtractionLayer(m_flatBufferBuilder, fbSubtractionBaseLayer);
1255 
1256  CreateAnyLayer(fbSubtractionLayer.o, serializer::Layer::Layer_SubtractionLayer);
1257 }
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 1259 of file Serializer.cpp.

References armnn::IgnoreUnused().

Referenced by SerializerVisitor::GetSerializedLayers().

1260 {
1261  IgnoreUnused(name);
1262 
1263  auto fbSwitchBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Switch);
1264  auto fbSwitchLayer = serializer::CreateSwitchLayer(m_flatBufferBuilder, fbSwitchBaseLayer);
1265 
1266  CreateAnyLayer(fbSwitchLayer.o, serializer::Layer::Layer_SwitchLayer);
1267 }
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 1269 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().

1275 {
1276  IgnoreUnused(name);
1277 
1278  auto fbBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Convolution2d);
1279  auto fbDescriptor = CreateTransposeConvolution2dDescriptor(m_flatBufferBuilder,
1280  descriptor.m_PadLeft,
1281  descriptor.m_PadRight,
1282  descriptor.m_PadTop,
1283  descriptor.m_PadBottom,
1284  descriptor.m_StrideX,
1285  descriptor.m_StrideY,
1286  descriptor.m_BiasEnabled,
1288 
1289  // weights & biases
1290  auto fbWeightsConstTensorInfo = CreateConstTensorInfo(weights);
1291  flatbuffers::Offset<serializer::ConstTensor> fbBiasesConstTensorInfo;
1292  if (biases.has_value())
1293  {
1294  fbBiasesConstTensorInfo = CreateConstTensorInfo(biases.value());
1295  }
1296 
1297  auto fbLayer = CreateTransposeConvolution2dLayer(m_flatBufferBuilder,
1298  fbBaseLayer,
1299  fbDescriptor,
1300  fbWeightsConstTensorInfo,
1301  fbBiasesConstTensorInfo);
1302 
1303  CreateAnyLayer(fbLayer.o, serializer::Layer::Layer_TransposeConvolution2dLayer);
1304 }
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 1306 of file Serializer.cpp.

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

Referenced by SerializerVisitor::GetSerializedLayers().

1309 {
1310  IgnoreUnused(name);
1311 
1312  // Create FlatBuffer BaseLayer
1313  auto flatBufferBaseLayer = CreateLayerBase(layer, serializer::LayerType::LayerType_Transpose);
1314 
1315  std::vector<unsigned int> dimMappings;
1316  for (unsigned int i=0; i<descriptor.m_DimMappings.GetSize(); ++i)
1317  {
1318  dimMappings.push_back(descriptor.m_DimMappings[i]);
1319  }
1320 
1321  auto flatBufferDesc = serializer::CreateTransposeDescriptor(m_flatBufferBuilder,
1322  m_flatBufferBuilder.CreateVector(dimMappings));
1323 
1324  // Create the FlatBuffer TransposeLayer
1325  auto flatBufferLayer = serializer::CreateTransposeLayer(m_flatBufferBuilder,
1326  flatBufferBaseLayer,
1327  flatBufferDesc);
1328 
1329  // Add the AnyLayer to the FlatBufferLayers
1330  CreateAnyLayer(flatBufferLayer.o, serializer::Layer::Layer_TransposeLayer);
1331 }
void IgnoreUnused(Ts &&...)

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