ArmNN
 24.08
armnnSerializer Namespace Reference

Classes

class  ISerializer
 
class  SerializerStrategy
 

Typedefs

using ISerializerPtr = std::unique_ptr< ISerializer, void(*)(ISerializer *serializer)>
 

Functions

serializer::ActivationFunction GetFlatBufferActivationFunction (armnn::ActivationFunction function)
 
serializer::ArgMinMaxFunction GetFlatBufferArgMinMaxFunction (armnn::ArgMinMaxFunction function)
 
serializer::ScatterNdFunction GetFlatBufferScatterNdFunction (armnn::ScatterNdFunction function)
 
armnnSerializer::ComparisonOperation GetFlatBufferComparisonOperation (armnn::ComparisonOperation comparisonOperation)
 
armnnSerializer::LogicalBinaryOperation GetFlatBufferLogicalBinaryOperation (armnn::LogicalBinaryOperation logicalBinaryOperation)
 
armnnSerializer::ConstTensorData GetFlatBufferConstTensorData (armnn::DataType dataType)
 
armnnSerializer::DataType GetFlatBufferDataType (armnn::DataType dataType)
 
armnnSerializer::DataLayout GetFlatBufferDataLayout (armnn::DataLayout dataLayout)
 
armnnSerializer::BinaryOperation GetFlatBufferBinaryOperation (armnn::BinaryOperation binaryOperation)
 
armnnSerializer::UnaryOperation GetFlatBufferUnaryOperation (armnn::UnaryOperation unaryOperation)
 
armnnSerializer::PoolingAlgorithm GetFlatBufferPoolingAlgorithm (armnn::PoolingAlgorithm poolingAlgorithm)
 
armnnSerializer::OutputShapeRounding GetFlatBufferOutputShapeRounding (armnn::OutputShapeRounding outputShapeRounding)
 
armnnSerializer::PaddingMethod GetFlatBufferPaddingMethod (armnn::PaddingMethod paddingMethod)
 
armnnSerializer::PaddingMode GetFlatBufferPaddingMode (armnn::PaddingMode paddingMode)
 
armnnSerializer::NormalizationAlgorithmChannel GetFlatBufferNormalizationAlgorithmChannel (armnn::NormalizationAlgorithmChannel normalizationAlgorithmChannel)
 
armnnSerializer::NormalizationAlgorithmMethod GetFlatBufferNormalizationAlgorithmMethod (armnn::NormalizationAlgorithmMethod normalizationAlgorithmMethod)
 
armnnSerializer::ResizeMethod GetFlatBufferResizeMethod (armnn::ResizeMethod method)
 
armnnSerializer::ReduceOperation GetFlatBufferReduceOperation (armnn::ReduceOperation reduceOperation)
 

Typedef Documentation

◆ ISerializerPtr

using ISerializerPtr = std::unique_ptr<ISerializer, void(*)(ISerializer* serializer)>

Definition at line 15 of file ISerializer.hpp.

Function Documentation

◆ GetFlatBufferActivationFunction()

serializer::ActivationFunction armnnSerializer::GetFlatBufferActivationFunction ( armnn::ActivationFunction  function)

Definition at line 55 of file Serializer.cpp.

56 {
57  switch (function)
58  {
60  return serializer::ActivationFunction::ActivationFunction_Sigmoid;
62  return serializer::ActivationFunction::ActivationFunction_TanH;
64  return serializer::ActivationFunction::ActivationFunction_Linear;
66  return serializer::ActivationFunction::ActivationFunction_ReLu;
68  return serializer::ActivationFunction::ActivationFunction_BoundedReLu;
70  return serializer::ActivationFunction::ActivationFunction_LeakyReLu;
72  return serializer::ActivationFunction::ActivationFunction_Abs;
74  return serializer::ActivationFunction::ActivationFunction_Sqrt;
76  return serializer::ActivationFunction::ActivationFunction_Square;
78  return serializer::ActivationFunction::ActivationFunction_Elu;
80  return serializer::ActivationFunction::ActivationFunction_HardSwish;
82  return serializer::ActivationFunction::ActivationFunction_Gelu;
83  default:
84  return serializer::ActivationFunction::ActivationFunction_Sigmoid;
85  }
86 }

References armnn::Abs, armnn::BoundedReLu, armnn::Elu, armnn::Gelu, armnn::HardSwish, armnn::LeakyReLu, armnn::Linear, armnn::ReLu, armnn::Sigmoid, armnn::Sqrt, armnn::Square, and armnn::TanH.

◆ GetFlatBufferArgMinMaxFunction()

serializer::ArgMinMaxFunction armnnSerializer::GetFlatBufferArgMinMaxFunction ( armnn::ArgMinMaxFunction  function)

Definition at line 88 of file Serializer.cpp.

89 {
90  switch (function)
91  {
93  return serializer::ArgMinMaxFunction::ArgMinMaxFunction_Max;
95  default:
96  return serializer::ArgMinMaxFunction::ArgMinMaxFunction_Min;
97  }
98 }

References armnn::Max, and armnn::Min.

◆ GetFlatBufferBinaryOperation()

armnnSerializer::BinaryOperation GetFlatBufferBinaryOperation ( armnn::BinaryOperation  binaryOperation)

Definition at line 110 of file SerializerUtils.cpp.

111 {
112  switch (binaryOperation)
113  {
115  return armnnSerializer::BinaryOperation::BinaryOperation_Add;
117  return armnnSerializer::BinaryOperation::BinaryOperation_Div;
119  return armnnSerializer::BinaryOperation::BinaryOperation_Maximum;
121  return armnnSerializer::BinaryOperation::BinaryOperation_Minimum;
123  return armnnSerializer::BinaryOperation::BinaryOperation_Mul;
125  return armnnSerializer::BinaryOperation::BinaryOperation_Sub;
127  return armnnSerializer::BinaryOperation::BinaryOperation_SqDiff;
129  return armnnSerializer::BinaryOperation::BinaryOperation_Power;
130  default:
131  throw armnn::InvalidArgumentException("Elementwise Binary operation unknown");
132  }
133 }

References armnn::Add, armnn::Div, armnn::Maximum, armnn::Minimum, armnn::Mul, armnn::Power, armnn::SqDiff, and armnn::Sub.

◆ GetFlatBufferComparisonOperation()

armnnSerializer::ComparisonOperation GetFlatBufferComparisonOperation ( armnn::ComparisonOperation  comparisonOperation)

Definition at line 11 of file SerializerUtils.cpp.

12 {
13  switch (comparisonOperation)
14  {
16  return armnnSerializer::ComparisonOperation::ComparisonOperation_Equal;
18  return armnnSerializer::ComparisonOperation::ComparisonOperation_Greater;
20  return armnnSerializer::ComparisonOperation::ComparisonOperation_GreaterOrEqual;
22  return armnnSerializer::ComparisonOperation::ComparisonOperation_Less;
24  return armnnSerializer::ComparisonOperation::ComparisonOperation_LessOrEqual;
26  default:
27  return armnnSerializer::ComparisonOperation::ComparisonOperation_NotEqual;
28  }
29 }

References armnn::Equal, armnn::Greater, armnn::GreaterOrEqual, armnn::Less, armnn::LessOrEqual, and armnn::NotEqual.

◆ GetFlatBufferConstTensorData()

armnnSerializer::ConstTensorData GetFlatBufferConstTensorData ( armnn::DataType  dataType)

Definition at line 45 of file SerializerUtils.cpp.

46 {
47  switch (dataType)
48  {
51  return armnnSerializer::ConstTensorData::ConstTensorData_IntData;
54  return armnnSerializer::ConstTensorData::ConstTensorData_ShortData;
59  return armnnSerializer::ConstTensorData::ConstTensorData_ByteData;
61  return armnnSerializer::ConstTensorData::ConstTensorData_LongData;
62  default:
63  return armnnSerializer::ConstTensorData::ConstTensorData_NONE;
64  }
65 }

References armnn::Boolean, armnn::Float16, armnn::Float32, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::QSymmS8, armnn::Signed32, and armnn::Signed64.

◆ GetFlatBufferDataLayout()

armnnSerializer::DataLayout GetFlatBufferDataLayout ( armnn::DataLayout  dataLayout)

Definition at line 94 of file SerializerUtils.cpp.

95 {
96  switch (dataLayout)
97  {
99  return armnnSerializer::DataLayout::DataLayout_NHWC;
101  return armnnSerializer::DataLayout::DataLayout_NDHWC;
103  return armnnSerializer::DataLayout::DataLayout_NCDHW;
105  default:
106  return armnnSerializer::DataLayout::DataLayout_NCHW;
107  }
108 }

References armnn::NCDHW, armnn::NCHW, armnn::NDHWC, and armnn::NHWC.

◆ GetFlatBufferDataType()

armnnSerializer::DataType GetFlatBufferDataType ( armnn::DataType  dataType)

Definition at line 67 of file SerializerUtils.cpp.

68 {
69  switch (dataType)
70  {
72  return armnnSerializer::DataType::DataType_Float32;
74  return armnnSerializer::DataType::DataType_Float16;
76  return armnnSerializer::DataType::DataType_Signed32;
78  return armnnSerializer::DataType::DataType_Signed64;
80  return armnnSerializer::DataType::DataType_QSymmS16;
82  return armnnSerializer::DataType::DataType_QAsymmS8;
84  return armnnSerializer::DataType::DataType_QAsymmU8;
86  return armnnSerializer::DataType::DataType_QSymmS8;
88  return armnnSerializer::DataType::DataType_Boolean;
89  default:
90  return armnnSerializer::DataType::DataType_Float16;
91  }
92 }

References armnn::Boolean, armnn::Float16, armnn::Float32, armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS16, armnn::QSymmS8, armnn::Signed32, and armnn::Signed64.

◆ GetFlatBufferLogicalBinaryOperation()

armnnSerializer::LogicalBinaryOperation GetFlatBufferLogicalBinaryOperation ( armnn::LogicalBinaryOperation  logicalBinaryOperation)

Definition at line 31 of file SerializerUtils.cpp.

33 {
34  switch (logicalBinaryOperation)
35  {
37  return armnnSerializer::LogicalBinaryOperation::LogicalBinaryOperation_LogicalAnd;
39  return armnnSerializer::LogicalBinaryOperation::LogicalBinaryOperation_LogicalOr;
40  default:
41  throw armnn::InvalidArgumentException("Logical Binary operation unknown");
42  }
43 }

References armnn::LogicalAnd, and armnn::LogicalOr.

◆ GetFlatBufferNormalizationAlgorithmChannel()

armnnSerializer::NormalizationAlgorithmChannel GetFlatBufferNormalizationAlgorithmChannel ( armnn::NormalizationAlgorithmChannel  normalizationAlgorithmChannel)

Definition at line 213 of file SerializerUtils.cpp.

215 {
216  switch (normalizationAlgorithmChannel)
217  {
219  return armnnSerializer::NormalizationAlgorithmChannel::NormalizationAlgorithmChannel_Across;
221  return armnnSerializer::NormalizationAlgorithmChannel::NormalizationAlgorithmChannel_Within;
222  default:
223  return armnnSerializer::NormalizationAlgorithmChannel::NormalizationAlgorithmChannel_Across;
224  }
225 }

References armnn::Across, and armnn::Within.

◆ GetFlatBufferNormalizationAlgorithmMethod()

armnnSerializer::NormalizationAlgorithmMethod GetFlatBufferNormalizationAlgorithmMethod ( armnn::NormalizationAlgorithmMethod  normalizationAlgorithmMethod)

Definition at line 227 of file SerializerUtils.cpp.

229 {
230  switch (normalizationAlgorithmMethod)
231  {
233  return armnnSerializer::NormalizationAlgorithmMethod::NormalizationAlgorithmMethod_LocalBrightness;
235  return armnnSerializer::NormalizationAlgorithmMethod::NormalizationAlgorithmMethod_LocalContrast;
236  default:
237  return armnnSerializer::NormalizationAlgorithmMethod::NormalizationAlgorithmMethod_LocalBrightness;
238  }
239 }

References armnn::LocalBrightness, and armnn::LocalContrast.

◆ GetFlatBufferOutputShapeRounding()

armnnSerializer::OutputShapeRounding GetFlatBufferOutputShapeRounding ( armnn::OutputShapeRounding  outputShapeRounding)

Definition at line 176 of file SerializerUtils.cpp.

177 {
178  switch (outputShapeRounding)
179  {
181  return armnnSerializer::OutputShapeRounding::OutputShapeRounding_Ceiling;
183  default:
184  return armnnSerializer::OutputShapeRounding::OutputShapeRounding_Floor;
185  }
186 }

References armnn::Ceiling, and armnn::Floor.

◆ GetFlatBufferPaddingMethod()

armnnSerializer::PaddingMethod GetFlatBufferPaddingMethod ( armnn::PaddingMethod  paddingMethod)

Definition at line 188 of file SerializerUtils.cpp.

189 {
190  switch (paddingMethod)
191  {
193  return armnnSerializer::PaddingMethod::PaddingMethod_IgnoreValue;
195  default:
196  return armnnSerializer::PaddingMethod::PaddingMethod_Exclude;
197  }
198 }

References armnn::Exclude, and armnn::IgnoreValue.

◆ GetFlatBufferPaddingMode()

armnnSerializer::PaddingMode GetFlatBufferPaddingMode ( armnn::PaddingMode  paddingMode)

Definition at line 200 of file SerializerUtils.cpp.

201 {
202  switch (paddingMode)
203  {
205  return armnnSerializer::PaddingMode::PaddingMode_Reflect;
207  return armnnSerializer::PaddingMode::PaddingMode_Symmetric;
208  default:
209  return armnnSerializer::PaddingMode::PaddingMode_Constant;
210  }
211 }

References armnn::Reflect, and armnn::Symmetric.

◆ GetFlatBufferPoolingAlgorithm()

armnnSerializer::PoolingAlgorithm GetFlatBufferPoolingAlgorithm ( armnn::PoolingAlgorithm  poolingAlgorithm)

Definition at line 162 of file SerializerUtils.cpp.

163 {
164  switch (poolingAlgorithm)
165  {
167  return armnnSerializer::PoolingAlgorithm::PoolingAlgorithm_Average;
169  return armnnSerializer::PoolingAlgorithm::PoolingAlgorithm_L2;
171  default:
172  return armnnSerializer::PoolingAlgorithm::PoolingAlgorithm_Max;
173  }
174 }

References armnn::Average, armnn::L2, and armnn::Max.

◆ GetFlatBufferReduceOperation()

armnnSerializer::ReduceOperation GetFlatBufferReduceOperation ( armnn::ReduceOperation  reduceOperation)

Definition at line 254 of file SerializerUtils.cpp.

255 {
256  switch (reduceOperation)
257  {
259  return armnnSerializer::ReduceOperation::ReduceOperation_Sum;
261  return armnnSerializer::ReduceOperation::ReduceOperation_Max;
263  return armnnSerializer::ReduceOperation::ReduceOperation_Mean;
265  return armnnSerializer::ReduceOperation::ReduceOperation_Min;
267  return armnnSerializer::ReduceOperation::ReduceOperation_Prod;
268  default:
269  return armnnSerializer::ReduceOperation::ReduceOperation_Sum;
270  }
271 }

References armnn::Max, armnn::Mean, armnn::Min, armnn::Prod, and armnn::Sum.

◆ GetFlatBufferResizeMethod()

armnnSerializer::ResizeMethod GetFlatBufferResizeMethod ( armnn::ResizeMethod  method)

Definition at line 241 of file SerializerUtils.cpp.

242 {
243  switch (method)
244  {
246  return armnnSerializer::ResizeMethod_NearestNeighbor;
248  return armnnSerializer::ResizeMethod_Bilinear;
249  default:
250  return armnnSerializer::ResizeMethod_NearestNeighbor;
251  }
252 }

References armnn::Bilinear, and armnn::NearestNeighbor.

◆ GetFlatBufferScatterNdFunction()

serializer::ScatterNdFunction armnnSerializer::GetFlatBufferScatterNdFunction ( armnn::ScatterNdFunction  function)

Definition at line 100 of file Serializer.cpp.

101 {
102  switch (function)
103  {
105  return serializer::ScatterNdFunction::ScatterNdFunction_Update;
107  return serializer::ScatterNdFunction::ScatterNdFunction_Add;
109  return serializer::ScatterNdFunction::ScatterNdFunction_Sub;
111  return serializer::ScatterNdFunction::ScatterNdFunction_Max;
113  return serializer::ScatterNdFunction::ScatterNdFunction_Min;
114  default:
115  return serializer::ScatterNdFunction::ScatterNdFunction_Update;
116  }
117 }

References armnn::Add, armnn::Max, armnn::Min, armnn::Sub, and armnn::Update.

◆ GetFlatBufferUnaryOperation()

armnnSerializer::UnaryOperation GetFlatBufferUnaryOperation ( armnn::UnaryOperation  unaryOperation)

Definition at line 135 of file SerializerUtils.cpp.

136 {
137  switch (unaryOperation)
138  {
140  return armnnSerializer::UnaryOperation::UnaryOperation_Abs;
142  return armnnSerializer::UnaryOperation::UnaryOperation_Ceil;
144  return armnnSerializer::UnaryOperation::UnaryOperation_Rsqrt;
146  return armnnSerializer::UnaryOperation::UnaryOperation_Sqrt;
148  return armnnSerializer::UnaryOperation::UnaryOperation_Exp;
150  return armnnSerializer::UnaryOperation::UnaryOperation_Neg;
152  return armnnSerializer::UnaryOperation::UnaryOperation_LogicalNot;
154  return armnnSerializer::UnaryOperation::UnaryOperation_Log;
156  return armnnSerializer::UnaryOperation::UnaryOperation_Sin;
157  default:
158  throw armnn::InvalidArgumentException("Elementwise Unary operation unknown");
159  }
160 }

References armnn::Abs, armnn::Ceil, armnn::Exp, armnn::Log, armnn::LogicalNot, armnn::Neg, armnn::Rsqrt, armnn::Sin, and armnn::Sqrt.

armnn::ArgMinMaxFunction::Max
@ Max
armnn::PaddingMode::Symmetric
@ Symmetric
armnn::BinaryOperation::Mul
@ Mul
armnn::DataType::Boolean
@ Boolean
armnn::NormalizationAlgorithmChannel::Within
@ Within
armnn::BinaryOperation::Add
@ Add
armnn::ComparisonOperation::LessOrEqual
@ LessOrEqual
armnn::ScatterNdFunction::Min
@ Min
armnn::DataLayout::NCDHW
@ NCDHW
armnn::ActivationFunction::LeakyReLu
@ LeakyReLu
armnn::ScatterNdFunction::Sub
@ Sub
armnn::DataLayout::NHWC
@ NHWC
armnn::ActivationFunction::Sqrt
@ Sqrt
armnn::NormalizationAlgorithmMethod::LocalBrightness
@ LocalBrightness
Krichevsky 2012: Local Brightness Normalization.
armnn::BinaryOperation::Sub
@ Sub
armnn::OutputShapeRounding::Floor
@ Floor
armnn::DataType::Float32
@ Float32
armnn::ActivationFunction::TanH
@ TanH
armnn::LogicalBinaryOperation::LogicalOr
@ LogicalOr
armnn::PoolingAlgorithm::L2
@ L2
armnn::DataType::QAsymmU8
@ QAsymmU8
armnn::ActivationFunction::BoundedReLu
@ BoundedReLu
min(a, max(b, input)) ReLu1 & ReLu6.
armnn::DataType::QSymmS8
@ QSymmS8
armnn::UnaryOperation::Neg
@ Neg
armnn::ReduceOperation::Mean
@ Mean
armnn::ActivationFunction::HardSwish
@ HardSwish
armnn::DataType::QSymmS16
@ QSymmS16
armnn::ActivationFunction::Gelu
@ Gelu
armnn::NormalizationAlgorithmChannel::Across
@ Across
armnn::ComparisonOperation::NotEqual
@ NotEqual
armnn::ComparisonOperation::GreaterOrEqual
@ GreaterOrEqual
armnn::DataLayout::NDHWC
@ NDHWC
armnn::BinaryOperation::Maximum
@ Maximum
armnn::DataType::Float16
@ Float16
armnn::BinaryOperation::SqDiff
@ SqDiff
armnn::UnaryOperation::Rsqrt
@ Rsqrt
armnn::ComparisonOperation::Less
@ Less
armnn::UnaryOperation::Sqrt
@ Sqrt
armnn::UnaryOperation::LogicalNot
@ LogicalNot
armnn::UnaryOperation::Exp
@ Exp
armnn::PaddingMethod::Exclude
@ Exclude
The padding fields don't count and are ignored.
armnn::ActivationFunction::Elu
@ Elu
armnn::PaddingMethod::IgnoreValue
@ IgnoreValue
The padding fields count, but are ignored.
armnn::InvalidArgumentException
Definition: Exceptions.hpp:80
armnn::UnaryOperation::Sin
@ Sin
armnn::ActivationFunction::Linear
@ Linear
armnn::ReduceOperation::Sum
@ Sum
armnn::ScatterNdFunction::Add
@ Add
armnn::ResizeMethod::NearestNeighbor
@ NearestNeighbor
armnn::BinaryOperation::Power
@ Power
armnn::PoolingAlgorithm::Average
@ Average
armnn::DataType::Signed32
@ Signed32
armnn::UnaryOperation::Ceil
@ Ceil
armnn::ReduceOperation::Prod
@ Prod
armnn::ActivationFunction::Abs
@ Abs
armnn::DataType::QAsymmS8
@ QAsymmS8
armnn::ResizeMethod::Bilinear
@ Bilinear
armnn::ArgMinMaxFunction::Min
@ Min
armnn::UnaryOperation::Log
@ Log
armnn::LogicalBinaryOperation::LogicalAnd
@ LogicalAnd
armnn::ScatterNdFunction::Update
@ Update
armnn::BinaryOperation::Minimum
@ Minimum
armnn::ScatterNdFunction::Max
@ Max
armnn::ActivationFunction::ReLu
@ ReLu
armnn::PoolingAlgorithm::Max
@ Max
armnn::UnaryOperation::Abs
@ Abs
armnn::ReduceOperation::Min
@ Min
armnn::ActivationFunction::Square
@ Square
armnn::BinaryOperation::Div
@ Div
armnn::OutputShapeRounding::Ceiling
@ Ceiling
armnn::DataType::Signed64
@ Signed64
armnn::ComparisonOperation::Equal
@ Equal
armnn::NormalizationAlgorithmMethod::LocalContrast
@ LocalContrast
Jarret 2009: Local Contrast Normalization.
armnn::PaddingMode::Reflect
@ Reflect
armnn::ReduceOperation::Max
@ Max
armnn::DataLayout::NCHW
@ NCHW
armnn::ActivationFunction::Sigmoid
@ Sigmoid
armnn::ComparisonOperation::Greater
@ Greater