ArmNN
 23.02
TfLiteParser.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Descriptors.hpp>
8 #include "armnn/INetwork.hpp"
10 #include "armnn/Types.hpp"
11 
12 #include <schema_generated.h>
13 #include <functional>
14 #include <unordered_map>
15 #include <vector>
16 
17 #include <tensorflow/lite/version.h>
18 
19 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 3)
20 #define ARMNN_POST_TFLITE_2_3
21 #endif
22 
23 namespace armnnTfLiteParser
24 {
25 
27 {
28 public:
29  // Shorthands for TfLite types
30  using ModelPtr = std::unique_ptr<tflite::ModelT>;
31  using SubgraphPtr = std::unique_ptr<tflite::SubGraphT>;
32  using OperatorPtr = std::unique_ptr<tflite::OperatorT>;
33  using OperatorCodePtr = std::unique_ptr<tflite::OperatorCodeT>;
34  using TensorPtr = std::unique_ptr<tflite::TensorT>;
35  using TensorRawPtr = const tflite::TensorT *;
36  using TensorRawPtrVector = std::vector<TensorRawPtr>;
37  using TensorIdRawPtr = std::pair<size_t, TensorRawPtr>;
38  using TensorIdRawPtrVector = std::vector<TensorIdRawPtr>;
39  using BufferPtr = std::unique_ptr<tflite::BufferT>;
40  using BufferRawPtr = const tflite::BufferT *;
41 
42 public:
43  /// Create the network from a flatbuffers binary file on disk
44  armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile);
45 
46  /// Create the network from a flatbuffers binary
47  armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t> & binaryContent);
48 
49 
50  /// Retrieve binding info (layer id and tensor info) for the network input identified by
51  /// the given layer name and subgraph id
53  const std::string& name) const;
54 
55  /// Retrieve binding info (layer id and tensor info) for the network output identified by
56  /// the given layer name and subgraph id
58  const std::string& name) const;
59 
60  /// Return the number of subgraphs in the parsed model
61  size_t GetSubgraphCount() const;
62 
63  /// Return the input tensor names for a given subgraph
64  std::vector<std::string> GetSubgraphInputTensorNames(size_t subgraphId) const;
65 
66  /// Return the output tensor names for a given subgraph
67  std::vector<std::string> GetSubgraphOutputTensorNames(size_t subgraphId) const;
68 
70  ~TfLiteParserImpl() = default;
71 
72 public:
73  // testable helpers
74  armnn::INetworkPtr CreateNetworkFromBinaryAsDynamic(const std::vector<uint8_t>& binaryContent);
75 
76  armnn::INetworkPtr LoadModel(std::unique_ptr<tflite::ModelT> model);
77 
78  static ModelPtr LoadModelFromFile(const char* fileName);
79  static ModelPtr LoadModelFromBinary(const uint8_t* binaryContent, size_t len);
80  static TensorRawPtrVector GetInputs(const ModelPtr& model, size_t subgraphIndex, size_t operatorIndex);
81  static TensorRawPtrVector GetOutputs(const ModelPtr& model, size_t subgraphIndex, size_t operatorIndex);
82  static TensorIdRawPtrVector GetSubgraphInputs(const ModelPtr& model, size_t subgraphIndex);
83  static TensorIdRawPtrVector GetSubgraphOutputs(const ModelPtr& model, size_t subgraphIndex);
84  static std::vector<int32_t>& GetInputTensorIds(const ModelPtr& model, size_t subgraphIndex, size_t operatorIndex);
85  static std::vector<int32_t>& GetOutputTensorIds(const ModelPtr& model, size_t subgraphIndex, size_t operatorIndex);
86 
87  static BufferRawPtr GetBuffer(const ModelPtr& model, size_t bufferIndex);
88  static armnn::TensorInfo OutputShapeOfSqueeze(std::vector<uint32_t> squeezeDims,
89  const armnn::TensorInfo& inputTensorInfo);
90  static armnn::TensorInfo OutputShapeOfReshape(const armnn::TensorInfo& inputTensorInfo,
91  const std::vector<int32_t>& targetDimsIn);
92 
93  /// Retrieve version in X.Y.Z form
94  static const std::string GetVersion();
95 
96 private:
97 
98  // No copying allowed until it is wanted and properly implemented
99  TfLiteParserImpl(const TfLiteParserImpl &) = delete;
100  TfLiteParserImpl & operator=(const TfLiteParserImpl &) = delete;
101 
102  /// Create the network from an already loaded flatbuffers model
103  armnn::INetworkPtr CreateNetworkFromModel();
104 
105  // signature for the parser functions
106  using OperatorParsingFunction = void(TfLiteParserImpl::*)(size_t subgraphIndex, size_t operatorIndex);
107 
108  void ParseCustomOperator(size_t subgraphIndex, size_t operatorIndex);
109  void ParseUnsupportedOperator(size_t subgraphIndex, size_t operatorIndex);
110 
111  void ParseAbs(size_t subgraphIndex, size_t operatorIndex);
112  void ParseActivation(size_t subgraphIndex, size_t operatorIndex, armnn::ActivationFunction activationType);
113  void ParseAdd(size_t subgraphIndex, size_t operatorIndex);
114  void ParseArgMinMax(size_t subgraphIndex, size_t operatorIndex, armnn::ArgMinMaxFunction argMinMaxFunction);
115  void ParseArgMin(size_t subgraphIndex, size_t operatorIndex);
116  void ParseArgMax(size_t subgraphIndex, size_t operatorIndex);
117  void ParseAveragePool2D(size_t subgraphIndex, size_t operatorIndex);
118  void ParseBatchMatMul(size_t subgraphIndex, size_t operatorIndex);
119  void ParseBatchToSpaceND(size_t subgraphIndex, size_t operatorIndex);
120  void ParseCast(size_t subgraphIndex, size_t operatorIndex);
121  void ParseComparison(size_t subgraphIndex, size_t operatorIndex, armnn::ComparisonOperation comparisonOperation);
122  void ParseConcatenation(size_t subgraphIndex, size_t operatorIndex);
123  void ParseConv2D(size_t subgraphIndex, size_t operatorIndex);
124  // Conv3D support was added in TF 2.5, so for backwards compatibility a hash define is needed.
125  #if defined(ARMNN_POST_TFLITE_2_4)
126  void ParseConv3D(size_t subgraphIndex, size_t operatorIndex);
127  #endif
128  void ParseDepthToSpace(size_t subgraphIndex, size_t operatorIndex);
129  void ParseDepthwiseConv2D(size_t subgraphIndex, size_t operatorIndex);
130  void ParseDequantize(size_t subgraphIndex, size_t operatorIndex);
131  void ParseDetectionPostProcess(size_t subgraphIndex, size_t operatorIndex);
132  void ParseDiv(size_t subgraphIndex, size_t operatorIndex);
133  void ParseElementwiseUnary(size_t subgraphIndex, size_t operatorIndex, armnn::UnaryOperation unaryOperation);
134  void ParseElu(size_t subgraphIndex, size_t operatorIndex);
135  void ParseEqual(size_t subgraphIndex, size_t operatorIndex);
136  void ParseExp(size_t subgraphIndex, size_t operatorIndex);
137  void ParseExpandDims(size_t subgraphIndex, size_t operatorIndex);
138  void ParseFloorDiv(size_t subgraphIndex, size_t operatorIndex);
139  void ParseFullyConnected(size_t subgraphIndex, size_t operatorIndex);
140  void ParseGather(size_t subgraphIndex, size_t operatorIndex);
141  void ParseGatherNd(size_t subgraphIndex, size_t operatorIndex);
142  void ParseGreater(size_t subgraphIndex, size_t operatorIndex);
143  void ParseGreaterOrEqual(size_t subgraphIndex, size_t operatorIndex);
144  void ParseHardSwish(size_t subgraphIndex, size_t operatorIndex);
145  void ParseLeakyRelu(size_t subgraphIndex, size_t operatorIndex);
146  void ParseLess(size_t subgraphIndex, size_t operatorIndex);
147  void ParseLessOrEqual(size_t subgraphIndex, size_t operatorIndex);
148  void ParseLog(size_t subgraphIndex, size_t operatorIndex);
149  void ParseLocalResponseNormalization(size_t subgraphIndex, size_t operatorIndex);
150  void ParseLogicalNot(size_t subgraphIndex, size_t operatorIndex);
151  void ParseLogistic(size_t subgraphIndex, size_t operatorIndex);
152  void ParseLogSoftmax(size_t subgraphIndex, size_t operatorIndex);
153  void ParseL2Normalization(size_t subgraphIndex, size_t operatorIndex);
154  void ParseMaxPool2D(size_t subgraphIndex, size_t operatorIndex);
155  void ParseMaximum(size_t subgraphIndex, size_t operatorIndex);
156  void ParseMean(size_t subgraphIndex, size_t operatorIndex);
157  void ParseMinimum(size_t subgraphIndex, size_t operatorIndex);
158  void ParseMirrorPad(size_t subgraphIndex, size_t operatorIndex);
159  void ParseMul(size_t subgraphIndex, size_t operatorIndex);
160  void ParseNeg(size_t subgraphIndex, size_t operatorIndex);
161  void ParseNotEqual(size_t subgraphIndex, size_t operatorIndex);
162  void ParsePack(size_t subgraphIndex, size_t operatorIndex);
163  void ParsePad(size_t subgraphIndex, size_t operatorIndex);
164  void ParsePool(size_t subgraphIndex, size_t operatorIndex, armnn::PoolingAlgorithm algorithm);
165  void ParsePrelu(size_t subgraphIndex, size_t operatorIndex);
166  void ParseQuantize(size_t subgraphIndex, size_t operatorIndex);
167  void ParseReduce(size_t subgraphIndex, size_t operatorIndex, armnn::ReduceOperation reduceOperation);
168  void ParseReduceMax(size_t subgraphIndex, size_t operatorIndex);
169  void ParseReduceMin(size_t subgraphIndex, size_t operatorIndex);
170  void ParseReduceProd(size_t subgraphIndex, size_t operatorIndex);
171  void ParseRelu(size_t subgraphIndex, size_t operatorIndex);
172  void ParseRelu6(size_t subgraphIndex, size_t operatorIndex);
173  void ParseReshape(size_t subgraphIndex, size_t operatorIndex);
174  void ParseResize(size_t subgraphIndex, size_t operatorIndex, armnn::ResizeMethod resizeMethod);
175  void ParseResizeBilinear(size_t subgraphIndex, size_t operatorIndex);
176  void ParseResizeNearestNeighbor(size_t subgraphIndex, size_t operatorIndex);
177  void ParseRsqrt(size_t subgraphIndex, size_t operatorIndex);
178  void ParseShape(size_t subgraphIndex, size_t operatorIndex);
179  void ParseSin(size_t subgraphIndex, size_t operatorIndex);
180  void ParseSlice(size_t subgraphIndex, size_t operatorIndex);
181  void ParseSoftmax(size_t subgraphIndex, size_t operatorIndex);
182  void ParseSqrt(size_t subgraphIndex, size_t operatorIndex);
183  void ParseSpaceToBatchND(size_t subgraphIndex, size_t operatorIndex);
184  void ParseSplit(size_t subgraphIndex, size_t operatorIndex);
185  void ParseSplitV(size_t subgraphIndex, size_t operatorIndex);
186  void ParseSqueeze(size_t subgraphIndex, size_t operatorIndex);
187  void ParseStridedSlice(size_t subgraphIndex, size_t operatorIndex);
188  void ParseSub(size_t subgraphIndex, size_t operatorIndex);
189  void ParseSum(size_t subgraphIndex, size_t operatorIndex);
190  void ParseTanH(size_t subgraphIndex, size_t operatorIndex);
191  void ParseTranspose(size_t subgraphIndex, size_t operatorIndex);
192  void ParseTransposeConv(size_t subgraphIndex, size_t operatorIndex);
193  void ParseUnidirectionalSequenceLSTM(size_t subgraphIndex, size_t operatorIndex);
194  void ParseUnpack(size_t subgraphIndex, size_t operatorIndex);
195 
196  void RegisterProducerOfTensor(size_t subgraphIndex, size_t tensorIndex, armnn::IOutputSlot* slot);
197  void RegisterConsumerOfTensor(size_t subgraphIndex, size_t tensorIndex, armnn::IInputSlot* slot);
198  void RegisterInputSlots(size_t subgraphIndex,
199  size_t operatorIndex,
201  const std::vector<unsigned int>& tensorIndexes,
202  unsigned int startingSlotIndex = 0);
203  void RegisterOutputSlots(size_t subgraphIndex,
204  size_t operatorIndex,
206  const std::vector<unsigned int>& tensorIndexes);
207 
208  void SetupInputLayerTensorInfos(size_t subgraphIndex);
209  void SetupConstantLayerTensorInfos(size_t subgraphIndex);
210 
211  void SetupInputLayers(size_t subgraphIndex);
212  void SetupOutputLayers(size_t subgraphIndex);
213  void SetupConstantLayers(size_t subgraphIndex);
214 
215  void ResetParser();
216 
217  void AddBroadcastReshapeLayer(size_t subgraphIndex,
218  size_t operatorIndex,
219  armnn::IConnectableLayer* layer);
220 
221  /// Attach an reshape layer to the one passed as a parameter
222  armnn::IConnectableLayer* AddReshapeLayer(armnn::IConnectableLayer* layer,
223  unsigned int outputSlot,
224  std::string reshapeLayerName,
225  armnn::TensorInfo outputShape);
226 
227  /// Attach an activation layer to the one passed as a parameter
228  armnn::IConnectableLayer* AddFusedActivationLayer(armnn::IConnectableLayer* layer,
229  unsigned int outputSlot,
230  tflite::ActivationFunctionType activationType);
231 
232  /// Attach a floor layer to the one passed as a parameter
233  armnn::IConnectableLayer* AddFusedFloorLayer(armnn::IConnectableLayer* layer, unsigned int outputSlot);
234 
235  // SupportedDataStorage's purpose is to hold data till we pass over to the network.
236  // We don't care about the content, and we want a single datatype to simplify the code.
237  struct SupportedDataStorage
238  {
239  public:
240  // Convenience constructors
241  SupportedDataStorage(std::unique_ptr<float[]>&& data);
242  SupportedDataStorage(std::unique_ptr<uint8_t[]>&& data);
243  SupportedDataStorage(std::unique_ptr<int8_t[]>&& data);
244  SupportedDataStorage(std::unique_ptr<int32_t[]>&& data);
245 
246  private:
247  // Pointers to the data buffers
248  std::unique_ptr<float[]> m_FloatData;
249  std::unique_ptr<uint8_t[]> m_Uint8Data;
250  std::unique_ptr<int8_t[]> m_Int8Data;
251  std::unique_ptr<int32_t[]> m_Int32Data;
252  };
253 
254  bool ShouldConstantTensorBeCreated(unsigned int tensorIndex);
255 
256  bool IsConstTensor(TensorRawPtr tensorPtr);
257 
258  bool ShouldConstantTensorBeConverted(TfLiteParserImpl::TensorRawPtr tensorPtr,
259  armnn::DataType inputDataType,
260  armnn::DataType filterDataType);
261 
262  armnn::ConstTensor CreateConstTensorNonPermuted(TensorRawPtr tensorPtr,
263  armnn::TensorInfo& tensorInfo);
264 
265  std::pair<armnn::ConstTensor, SupportedDataStorage>
266  CreateConstTensorPermuted(TensorRawPtr tensorPtr,
267  armnn::TensorInfo& tensorInfo,
269 
270  std::pair<armnn::ConstTensor, std::unique_ptr<float[]>>
271  CreateConstTensorNonPermuted(TensorRawPtr tensorPtr,
272  armnn::TensorInfo& tensorInfo,
273  armnn::DataType inputDataType);
274 
275  template<typename T>
276  std::pair<armnn::ConstTensor, TfLiteParserImpl::SupportedDataStorage>
277  CreateConstTensorAndStoreData(TfLiteParserImpl::BufferRawPtr bufferPtr,
279  armnn::TensorInfo& tensorInfo,
281 
282  std::pair<armnn::ConstTensor*, std::unique_ptr<float[]>>
283  CreateConstTensorPtr(TensorRawPtr tensorPtr,
284  armnn::TensorInfo& inputTensorInfo);
285 
286  armnn::TensorInfo InputTensorInfo(size_t subgraphIndex,
287  size_t operatorIndex,
288  int input);
289 
290  armnn::TensorInfo OutputTensorInfoFromInputs(size_t subgraphIndex,
291  size_t operatorIndex,
293  int output,
294  std::vector<int> inputs);
295 
296  armnn::TensorInfo OutputTensorInfoFromShapes(size_t subgraphIndex,
297  size_t operatorIndex,
299  int output = 0,
300  std::vector<armnn::TensorShape> inputShapes = {});
301 
302  /// Settings for configuring the TfLiteParser
304 
305  /// The network we're building. Gets cleared after it is passed to the user
306  armnn::INetworkPtr m_Network;
307  ModelPtr m_Model;
308 
309  std::vector<OperatorParsingFunction> m_ParserFunctions;
310  std::unordered_map<std::string, OperatorParsingFunction> m_CustomParserFunctions;
311 
312  /// A mapping of an output slot to each of the input slots it should be connected to
313  /// The outputSlot is from the layer that creates this tensor as one of its ouputs
314  /// The inputSlots are from the layers that use this tensor as one of their inputs
315  struct TensorSlots
316  {
317  armnn::IOutputSlot* outputSlot;
318  std::vector<armnn::IInputSlot*> inputSlots;
319 
320  TensorSlots() : outputSlot(nullptr) { }
321  };
322  typedef std::vector<TensorSlots> TensorConnections;
323  /// Connections for tensors in each subgraph
324  /// The first index is the subgraph ID, the second index is the tensor ID
325  std::vector<TensorConnections> m_SubgraphConnections;
326 
327  /// This is used in case that the model does not specify the output.
328  /// The shape can be calculated from the options.
329  std::vector<std::vector<unsigned int>> m_OverriddenOutputShapes;
330 
331  std::vector<unsigned int> m_ConstantsToDequantize;
332  std::vector<unsigned int> m_ConstantsToBeCreated;
333  std::map<size_t, armnn::TensorInfo> m_TensorInfos;
334 };
335 
336 }
armnnTfLiteParser::TfLiteParserImpl::GetSubgraphOutputs
static TensorIdRawPtrVector GetSubgraphOutputs(const ModelPtr &model, size_t subgraphIndex)
Definition: TfLiteParser.cpp:4782
armnnTfLiteParser
Definition: ITfLiteParser.hpp:17
armnnTfLiteParser::TfLiteParserImpl::LoadModelFromFile
static ModelPtr LoadModelFromFile(const char *fileName)
Definition: TfLiteParser.cpp:4675
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:68
armnnTfLiteParser::TfLiteParserImpl
Definition: TfLiteParser.hpp:26
armnnTfLiteParser::TfLiteParserImpl::OutputShapeOfSqueeze
static armnn::TensorInfo OutputShapeOfSqueeze(std::vector< uint32_t > squeezeDims, const armnn::TensorInfo &inputTensorInfo)
Definition: TfLiteParser.cpp:2137
armnn::ConstTensor
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:327
armnnTfLiteParser::BindingPointInfo
armnn::BindingPointInfo BindingPointInfo
Definition: ITfLiteParser.hpp:20
armnnTfLiteParser::TfLiteParserImpl::GetNetworkOutputBindingInfo
BindingPointInfo GetNetworkOutputBindingInfo(size_t subgraphId, const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer...
Definition: TfLiteParser.cpp:5229
armnnTfLiteParser::TfLiteParserImpl::ModelPtr
std::unique_ptr< tflite::ModelT > ModelPtr
Definition: TfLiteParser.hpp:30
armnnTfLiteParser::TfLiteParserImpl::OutputShapeOfReshape
static armnn::TensorInfo OutputShapeOfReshape(const armnn::TensorInfo &inputTensorInfo, const std::vector< int32_t > &targetDimsIn)
Definition: TfLiteParser.cpp:2882
armnn::ArgMinMaxFunction
ArgMinMaxFunction
Definition: Types.hpp:102
armnnTfLiteParser::TfLiteParserImpl::LoadModel
armnn::INetworkPtr LoadModel(std::unique_ptr< tflite::ModelT > model)
Definition: TfLiteParser.cpp:938
INetwork.hpp
armnn::IInputSlot
An input connection slot for a layer.
Definition: INetwork.hpp:25
armnnTfLiteParser::TfLiteParserImpl::CreateNetworkFromBinaryAsDynamic
armnn::INetworkPtr CreateNetworkFromBinaryAsDynamic(const std::vector< uint8_t > &binaryContent)
armnnTfLiteParser::TfLiteParserImpl::GetInputs
static TensorRawPtrVector GetInputs(const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex)
Definition: TfLiteParser.cpp:4718
armnn::PoolingAlgorithm
PoolingAlgorithm
Definition: Types.hpp:136
armnnTfLiteParser::TfLiteParserImpl::LoadModelFromBinary
static ModelPtr LoadModelFromBinary(const uint8_t *binaryContent, size_t len)
Definition: TfLiteParser.cpp:4699
armnn::ResizeMethod
ResizeMethod
Definition: Types.hpp:152
armnn::ReduceOperation
ReduceOperation
Definition: Types.hpp:143
armnnTfLiteParser::TfLiteParserImpl::GetInputTensorIds
static std::vector< int32_t > & GetInputTensorIds(const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex)
Definition: TfLiteParser.cpp:4798
armnnTfLiteParser::TfLiteParserImpl::CreateNetworkFromBinaryFile
armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile)
Create the network from a flatbuffers binary file on disk.
Definition: TfLiteParser.cpp:923
armnnTfLiteParser::TfLiteParserImpl::GetSubgraphCount
size_t GetSubgraphCount() const
Return the number of subgraphs in the parsed model.
Definition: TfLiteParser.cpp:5261
armnn::IOutputSlot
An output connection slot for a layer.
Definition: INetwork.hpp:41
armnn::ComparisonOperation
ComparisonOperation
Definition: Types.hpp:108
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::UnaryOperation
UnaryOperation
Definition: Types.hpp:124
armnnTfLiteParser::TfLiteParserImpl::GetSubgraphOutputTensorNames
std::vector< std::string > GetSubgraphOutputTensorNames(size_t subgraphId) const
Return the output tensor names for a given subgraph.
Definition: TfLiteParser.cpp:5279
armnnTfLiteParser::TfLiteParserImpl::GetOutputs
static TensorRawPtrVector GetOutputs(const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex)
Definition: TfLiteParser.cpp:4745
armnnTfLiteParser::TfLiteParserImpl::OperatorPtr
std::unique_ptr< tflite::OperatorT > OperatorPtr
Definition: TfLiteParser.hpp:32
armnn::EmptyOptional
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
armnnTfLiteParser::TfLiteParserImpl::GetSubgraphInputTensorNames
std::vector< std::string > GetSubgraphInputTensorNames(size_t subgraphId) const
Return the input tensor names for a given subgraph.
Definition: TfLiteParser.cpp:5266
armnnTfLiteParser::TfLiteParserImpl::TensorRawPtrVector
std::vector< TensorRawPtr > TensorRawPtrVector
Definition: TfLiteParser.hpp:36
armnnTfLiteParser::TfLiteParserImpl::~TfLiteParserImpl
~TfLiteParserImpl()=default
armnnTfLiteParser::TfLiteParserImpl::GetOutputTensorIds
static std::vector< int32_t > & GetOutputTensorIds(const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex)
Definition: TfLiteParser.cpp:4808
armnn::DataType
DataType
Definition: Types.hpp:48
ITfLiteParser.hpp
armnnTfLiteParser::TfLiteParserImpl::TensorIdRawPtrVector
std::vector< TensorIdRawPtr > TensorIdRawPtrVector
Definition: TfLiteParser.hpp:38
armnnTfLiteParser::TfLiteParserImpl::GetNetworkInputBindingInfo
BindingPointInfo GetNetworkInputBindingInfo(size_t subgraphId, const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
Definition: TfLiteParser.cpp:5197
armnnTfLiteParser::TfLiteParserImpl::BufferPtr
std::unique_ptr< tflite::BufferT > BufferPtr
Definition: TfLiteParser.hpp:39
armnnTfLiteParser::TfLiteParserImpl::TfLiteParserImpl
TfLiteParserImpl(const armnn::Optional< ITfLiteParser::TfLiteParserOptions > &options=armnn::EmptyOptional())
Definition: TfLiteParser.cpp:719
armnnTfLiteParser::TfLiteParserImpl::TensorIdRawPtr
std::pair< size_t, TensorRawPtr > TensorIdRawPtr
Definition: TfLiteParser.hpp:37
armnn::Optional
Definition: Optional.hpp:270
armnnTfLiteParser::TfLiteParserImpl::GetVersion
static const std::string GetVersion()
Retrieve version in X.Y.Z form.
Definition: TfLiteParser.cpp:5292
Descriptors.hpp
armnnTfLiteParser::TfLiteParserImpl::OperatorCodePtr
std::unique_ptr< tflite::OperatorCodeT > OperatorCodePtr
Definition: TfLiteParser.hpp:33
armnn::INetworkPtr
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:252
armnnTfLiteParser::TfLiteParserImpl::GetSubgraphInputs
static TensorIdRawPtrVector GetSubgraphInputs(const ModelPtr &model, size_t subgraphIndex)
Definition: TfLiteParser.cpp:4765
armnnTfLiteParser::TfLiteParserImpl::BufferRawPtr
const tflite::BufferT * BufferRawPtr
Definition: TfLiteParser.hpp:40
Types.hpp
armnnTfLiteParser::TfLiteParserImpl::TensorPtr
std::unique_ptr< tflite::TensorT > TensorPtr
Definition: TfLiteParser.hpp:34
armnnTfLiteParser::TfLiteParserImpl::TensorRawPtr
const tflite::TensorT * TensorRawPtr
Definition: TfLiteParser.hpp:35
armnnTfLiteParser::TfLiteParserImpl::SubgraphPtr
std::unique_ptr< tflite::SubGraphT > SubgraphPtr
Definition: TfLiteParser.hpp:31
armnnTfLiteParser::TfLiteParserImpl::CreateNetworkFromBinary
armnn::INetworkPtr CreateNetworkFromBinary(const std::vector< uint8_t > &binaryContent)
Create the network from a flatbuffers binary.
Definition: TfLiteParser.cpp:930
armnnTfLiteParser::TfLiteParserImpl::GetBuffer
static BufferRawPtr GetBuffer(const ModelPtr &model, size_t bufferIndex)
Definition: TfLiteParser.cpp:5019
armnn::ActivationFunction
ActivationFunction
Definition: Types.hpp:86