20.02
|
#include <TfLiteParser.hpp>
Public Types | |
using | ModelPtr = std::unique_ptr< tflite::ModelT > |
using | SubgraphPtr = std::unique_ptr< tflite::SubGraphT > |
using | OperatorPtr = std::unique_ptr< tflite::OperatorT > |
using | OperatorCodePtr = std::unique_ptr< tflite::OperatorCodeT > |
using | TensorPtr = std::unique_ptr< tflite::TensorT > |
using | TensorRawPtr = const tflite::TensorT * |
using | TensorRawPtrVector = std::vector< TensorRawPtr > |
using | TensorIdRawPtr = std::pair< size_t, TensorRawPtr > |
using | TensorIdRawPtrVector = std::vector< TensorIdRawPtr > |
using | BufferPtr = std::unique_ptr< tflite::BufferT > |
using | BufferRawPtr = const tflite::BufferT * |
Public Member Functions | |
virtual armnn::INetworkPtr | CreateNetworkFromBinaryFile (const char *graphFile) override |
Create the network from a flatbuffers binary file on disk. More... | |
virtual armnn::INetworkPtr | CreateNetworkFromBinary (const std::vector< uint8_t > &binaryContent) override |
Create the network from a flatbuffers binary. More... | |
virtual BindingPointInfo | GetNetworkInputBindingInfo (size_t subgraphId, const std::string &name) const override |
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name and subgraph id. More... | |
virtual BindingPointInfo | GetNetworkOutputBindingInfo (size_t subgraphId, const std::string &name) const override |
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name and subgraph id. More... | |
virtual size_t | GetSubgraphCount () const override |
Return the number of subgraphs in the parsed model. More... | |
virtual std::vector< std::string > | GetSubgraphInputTensorNames (size_t subgraphId) const override |
Return the input tensor names for a given subgraph. More... | |
virtual std::vector< std::string > | GetSubgraphOutputTensorNames (size_t subgraphId) const override |
Return the output tensor names for a given subgraph. More... | |
TfLiteParser (const armnn::Optional< ITfLiteParser::TfLiteParserOptions > &options=armnn::EmptyOptional()) | |
virtual | ~TfLiteParser () |
Static Public Member Functions | |
static ModelPtr | LoadModelFromFile (const char *fileName) |
static ModelPtr | LoadModelFromBinary (const uint8_t *binaryContent, size_t len) |
static TensorRawPtrVector | GetInputs (const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex) |
static TensorRawPtrVector | GetOutputs (const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex) |
static TensorIdRawPtrVector | GetSubgraphInputs (const ModelPtr &model, size_t subgraphIndex) |
static TensorIdRawPtrVector | GetSubgraphOutputs (const ModelPtr &model, size_t subgraphIndex) |
static std::vector< int32_t > & | GetInputTensorIds (const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex) |
static std::vector< int32_t > & | GetOutputTensorIds (const ModelPtr &model, size_t subgraphIndex, size_t operatorIndex) |
static BufferRawPtr | GetBuffer (const ModelPtr &model, size_t bufferIndex) |
static armnn::TensorInfo | OutputShapeOfSqueeze (const std::vector< uint32_t > &squeezeDims, const armnn::TensorInfo &inputTensorInfo) |
static armnn::TensorInfo | OutputShapeOfReshape (const armnn::TensorInfo &inputTensorInfo, const std::vector< int32_t > &targetDimsIn) |
Static Public Member Functions inherited from ITfLiteParser | |
static ITfLiteParser * | CreateRaw (const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional()) |
static ITfLiteParserPtr | Create (const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional()) |
static void | Destroy (ITfLiteParser *parser) |
Additional Inherited Members | |
Protected Member Functions inherited from ITfLiteParser | |
virtual | ~ITfLiteParser () |
Definition at line 19 of file TfLiteParser.hpp.
using BufferPtr = std::unique_ptr<tflite::BufferT> |
Definition at line 32 of file TfLiteParser.hpp.
using BufferRawPtr = const tflite::BufferT * |
Definition at line 33 of file TfLiteParser.hpp.
using ModelPtr = std::unique_ptr<tflite::ModelT> |
Definition at line 23 of file TfLiteParser.hpp.
using OperatorCodePtr = std::unique_ptr<tflite::OperatorCodeT> |
Definition at line 26 of file TfLiteParser.hpp.
using OperatorPtr = std::unique_ptr<tflite::OperatorT> |
Definition at line 25 of file TfLiteParser.hpp.
using SubgraphPtr = std::unique_ptr<tflite::SubGraphT> |
Definition at line 24 of file TfLiteParser.hpp.
using TensorIdRawPtr = std::pair<size_t, TensorRawPtr> |
Definition at line 30 of file TfLiteParser.hpp.
using TensorIdRawPtrVector = std::vector<TensorIdRawPtr> |
Definition at line 31 of file TfLiteParser.hpp.
using TensorPtr = std::unique_ptr<tflite::TensorT> |
Definition at line 27 of file TfLiteParser.hpp.
using TensorRawPtr = const tflite::TensorT * |
Definition at line 28 of file TfLiteParser.hpp.
using TensorRawPtrVector = std::vector<TensorRawPtr> |
Definition at line 29 of file TfLiteParser.hpp.
TfLiteParser | ( | const armnn::Optional< ITfLiteParser::TfLiteParserOptions > & | options = armnn::EmptyOptional() | ) |
Definition at line 488 of file TfLiteParser.cpp.
References CHECK_MODEL, CHECKED_NON_NEGATIVE, IOutputSlot::Connect(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetName(), TensorInfo::GetNumDimensions(), IConnectableLayer::GetOutputSlot(), TensorInfo::GetShape(), ReshapeDescriptor::m_TargetShape, TensorInfo::SetShape(), IOutputSlot::SetTensorInfo(), and armnnDeserializer::ToTensorInfo().
Referenced by ITfLiteParser::CreateRaw(), and TfLiteParser::~TfLiteParser().
|
inlinevirtual |
Definition at line 63 of file TfLiteParser.hpp.
References TfLiteParser::GetBuffer(), TfLiteParser::GetInputs(), TfLiteParser::GetInputTensorIds(), TfLiteParser::GetOutputs(), TfLiteParser::GetOutputTensorIds(), TfLiteParser::GetSubgraphInputs(), TfLiteParser::GetSubgraphOutputs(), TfLiteParser::LoadModelFromBinary(), TfLiteParser::LoadModelFromFile(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::TfLiteParser().
|
overridevirtual |
Create the network from a flatbuffers binary.
Implements ITfLiteParser.
Definition at line 605 of file TfLiteParser.cpp.
References ARMNN_LOG, armnnTfParser::CalcPadding(), CHECK_LOCATION, CHECK_MODEL, CHECK_SUPPORTED_FUSED_ACTIVATION, CHECK_TENSOR, CHECK_VALID_SIZE, CHECKED_NON_NEGATIVE, armnn::error, TfLiteParser::GetBuffer(), TfLiteParser::GetInputs(), TfLiteParser::GetInputTensorIds(), TensorInfo::GetNumBytes(), TensorInfo::GetNumDimensions(), TensorInfo::GetNumElements(), TfLiteParser::GetOutputs(), IConnectableLayer::GetOutputSlot(), TfLiteParser::GetOutputTensorIds(), TensorInfo::GetShape(), TfLiteParser::LoadModelFromBinary(), SoftmaxDescriptor::m_Beta, Convolution2dDescriptor::m_BiasEnabled, DepthwiseConvolution2dDescriptor::m_BiasEnabled, TransposeConvolution2dDescriptor::m_BiasEnabled, BatchToSpaceNdDescriptor::m_BlockShape, SpaceToBatchNdDescriptor::m_BlockShape, BatchToSpaceNdDescriptor::m_Crops, Pooling2dDescriptor::m_DataLayout, Convolution2dDescriptor::m_DataLayout, DepthwiseConvolution2dDescriptor::m_DataLayout, L2NormalizationDescriptor::m_DataLayout, BatchToSpaceNdDescriptor::m_DataLayout, SpaceToBatchNdDescriptor::m_DataLayout, TransposeConvolution2dDescriptor::m_DataLayout, Convolution2dDescriptor::m_DilationX, DepthwiseConvolution2dDescriptor::m_DilationX, Convolution2dDescriptor::m_DilationY, DepthwiseConvolution2dDescriptor::m_DilationY, Pooling2dDescriptor::m_OutputShapeRounding, Pooling2dDescriptor::m_PadBottom, Convolution2dDescriptor::m_PadBottom, DepthwiseConvolution2dDescriptor::m_PadBottom, TransposeConvolution2dDescriptor::m_PadBottom, Pooling2dDescriptor::m_PaddingMethod, Pooling2dDescriptor::m_PadLeft, Convolution2dDescriptor::m_PadLeft, DepthwiseConvolution2dDescriptor::m_PadLeft, TransposeConvolution2dDescriptor::m_PadLeft, SpaceToBatchNdDescriptor::m_PadList, Pooling2dDescriptor::m_PadRight, Convolution2dDescriptor::m_PadRight, DepthwiseConvolution2dDescriptor::m_PadRight, TransposeConvolution2dDescriptor::m_PadRight, Pooling2dDescriptor::m_PadTop, Convolution2dDescriptor::m_PadTop, DepthwiseConvolution2dDescriptor::m_PadTop, TransposeConvolution2dDescriptor::m_PadTop, Pooling2dDescriptor::m_PoolHeight, Pooling2dDescriptor::m_PoolType, Pooling2dDescriptor::m_PoolWidth, Pooling2dDescriptor::m_StrideX, Convolution2dDescriptor::m_StrideX, DepthwiseConvolution2dDescriptor::m_StrideX, TransposeConvolution2dDescriptor::m_StrideX, Pooling2dDescriptor::m_StrideY, Convolution2dDescriptor::m_StrideY, DepthwiseConvolution2dDescriptor::m_StrideY, TransposeConvolution2dDescriptor::m_StrideY, armnn::NHWC, armnn::numeric_cast(), options, TensorInfo::SetShape(), IOutputSlot::SetTensorInfo(), armnnDeserializer::ToTensorInfo(), and Exception::what().
|
overridevirtual |
Create the network from a flatbuffers binary file on disk.
Implements ITfLiteParser.
Definition at line 598 of file TfLiteParser.cpp.
References TfLiteParser::LoadModelFromFile().
|
static |
Definition at line 2886 of file TfLiteParser.cpp.
References CHECK_BUFFER, CHECK_BUFFER_SIZE, CHECK_LOCATION, CHECK_TENSOR_PTR, armnn::Float32, TensorInfo::GetDataType(), armnn::GetDataTypeName(), armnn::QAsymmS8, armnn::QAsymmU8, armnn::QSymmS8, and armnn::Signed32.
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::~TfLiteParser().
|
static |
Definition at line 2667 of file TfLiteParser.cpp.
References CHECK_MODEL, and CHECKED_NON_NEGATIVE.
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::~TfLiteParser().
|
static |
Definition at line 2739 of file TfLiteParser.cpp.
References CHECK_MODEL.
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::~TfLiteParser().
|
overridevirtual |
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name and subgraph id.
Implements ITfLiteParser.
Definition at line 2955 of file TfLiteParser.cpp.
References CHECK_LOCATION, CHECK_SUBGRAPH, TfLiteParser::GetSubgraphInputs(), and armnnDeserializer::ToTensorInfo().
|
overridevirtual |
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name and subgraph id.
Implements ITfLiteParser.
Definition at line 2985 of file TfLiteParser.cpp.
References CHECK_LOCATION, CHECK_SUBGRAPH, TfLiteParser::GetSubgraphOutputs(), and armnnDeserializer::ToTensorInfo().
|
static |
Definition at line 2686 of file TfLiteParser.cpp.
References CHECK_MODEL, CHECK_TENSOR, and CHECKED_NON_NEGATIVE.
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::~TfLiteParser().
|
static |
Definition at line 2749 of file TfLiteParser.cpp.
References CHECK_LOCATION, CHECK_MODEL, CHECK_SUBGRAPH, IConnectableLayer::GetInputSlot(), IConnectableLayer::GetNumInputSlots(), IConnectableLayer::GetNumOutputSlots(), IConnectableLayer::GetOutputSlot(), TfLiteParser::GetSubgraphInputs(), TfLiteParser::GetSubgraphOutputs(), IOutputSlot::SetTensorInfo(), and armnnDeserializer::ToTensorInfo().
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::OutputShapeOfReshape(), TfLiteParser::OutputShapeOfSqueeze(), and TfLiteParser::~TfLiteParser().
|
overridevirtual |
Return the number of subgraphs in the parsed model.
Implements ITfLiteParser.
Definition at line 3018 of file TfLiteParser.cpp.
|
static |
Definition at line 2706 of file TfLiteParser.cpp.
References CHECK_SUBGRAPH, CHECK_TENSOR, and CHECKED_NON_NEGATIVE.
Referenced by TfLiteParser::GetNetworkInputBindingInfo(), TfLiteParser::GetOutputTensorIds(), TfLiteParser::GetSubgraphInputTensorNames(), and TfLiteParser::~TfLiteParser().
|
overridevirtual |
Return the input tensor names for a given subgraph.
Implements ITfLiteParser.
Definition at line 3023 of file TfLiteParser.cpp.
References CHECK_SUBGRAPH, and TfLiteParser::GetSubgraphInputs().
|
static |
Definition at line 2723 of file TfLiteParser.cpp.
References CHECK_SUBGRAPH, and CHECKED_NON_NEGATIVE.
Referenced by TfLiteParser::GetNetworkOutputBindingInfo(), TfLiteParser::GetOutputTensorIds(), TfLiteParser::GetSubgraphOutputTensorNames(), and TfLiteParser::~TfLiteParser().
|
overridevirtual |
Return the output tensor names for a given subgraph.
Implements ITfLiteParser.
Definition at line 3036 of file TfLiteParser.cpp.
References CHECK_SUBGRAPH, and TfLiteParser::GetSubgraphOutputs().
|
static |
Definition at line 2648 of file TfLiteParser.cpp.
References CHECK_LOCATION.
Referenced by TfLiteParser::CreateNetworkFromBinary(), TfLiteParser::LoadModelFromFile(), and TfLiteParser::~TfLiteParser().
|
static |
Definition at line 2624 of file TfLiteParser.cpp.
References CHECK_LOCATION, and TfLiteParser::LoadModelFromBinary().
Referenced by TfLiteParser::CreateNetworkFromBinaryFile(), and TfLiteParser::~TfLiteParser().
|
static |
Definition at line 1898 of file TfLiteParser.cpp.
References ARMNN_THROW_PARSE_EXCEPTION, CHECK_LOCATION, CHECK_MODEL, CHECK_SUPPORTED_FUSED_ACTIVATION, CHECK_VALID_SIZE, CHECKED_NON_NEGATIVE, armnnDeserializer::CheckShape(), IOutputSlot::Connect(), TfLiteParser::GetBuffer(), TensorInfo::GetDataType(), TfLiteParser::GetInputs(), IConnectableLayer::GetInputSlot(), TfLiteParser::GetInputTensorIds(), IConnectableLayer::GetName(), TensorInfo::GetNumBytes(), TensorInfo::GetNumDimensions(), TensorInfo::GetNumElements(), IConnectableLayer::GetNumOutputSlots(), TfLiteParser::GetOutputs(), IConnectableLayer::GetOutputSlot(), TfLiteParser::GetOutputTensorIds(), TensorInfo::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), TensorInfo::GetShape(), ActivationDescriptor::m_A, StackDescriptor::m_Axis, ActivationDescriptor::m_B, FullyConnectedDescriptor::m_BiasEnabled, DetectionPostProcessDescriptor::m_DetectionsPerClass, ActivationDescriptor::m_Function, StackDescriptor::m_InputShape, DetectionPostProcessDescriptor::m_MaxClassesPerDetection, DetectionPostProcessDescriptor::m_MaxDetections, ResizeDescriptor::m_Method, DetectionPostProcessDescriptor::m_NmsIouThreshold, DetectionPostProcessDescriptor::m_NmsScoreThreshold, DetectionPostProcessDescriptor::m_NumClasses, StackDescriptor::m_NumInputs, DetectionPostProcessDescriptor::m_ScaleH, DetectionPostProcessDescriptor::m_ScaleW, DetectionPostProcessDescriptor::m_ScaleX, DetectionPostProcessDescriptor::m_ScaleY, ReshapeDescriptor::m_TargetShape, FullyConnectedDescriptor::m_TransposeWeightMatrix, DetectionPostProcessDescriptor::m_UseRegularNms, armnn::MaxNumOfTensorDimensions, armnn::NHWC, armnn::numeric_cast(), options, armnnUtils::ProcessConcatInputTensorInfo(), OriginsDescriptor::SetConcatAxis(), TensorInfo::SetShape(), IOutputSlot::SetTensorInfo(), ViewsDescriptor::SetViewOriginCoord(), ViewsDescriptor::SetViewSize(), and armnnDeserializer::ToTensorInfo().
Referenced by TfLiteParser::~TfLiteParser().
|
static |
Definition at line 1463 of file TfLiteParser.cpp.
References CHECK_LOCATION, CHECK_MODEL, CHECK_VALID_SIZE, TfLiteParser::GetBuffer(), TfLiteParser::GetInputs(), TfLiteParser::GetInputTensorIds(), TensorInfo::GetNumBytes(), TensorInfo::GetNumDimensions(), TensorInfo::GetNumElements(), TfLiteParser::GetOutputs(), IConnectableLayer::GetOutputSlot(), TfLiteParser::GetOutputTensorIds(), TensorInfo::GetShape(), armnn::IgnoreUnused(), ActivationDescriptor::m_A, MeanDescriptor::m_Axis, ActivationDescriptor::m_B, StridedSliceDescriptor::m_Begin, StridedSliceDescriptor::m_BeginMask, StridedSliceDescriptor::m_DataLayout, StridedSliceDescriptor::m_EllipsisMask, StridedSliceDescriptor::m_End, StridedSliceDescriptor::m_EndMask, ActivationDescriptor::m_Function, MeanDescriptor::m_KeepDims, StridedSliceDescriptor::m_NewAxisMask, PadDescriptor::m_PadList, StridedSliceDescriptor::m_ShrinkAxisMask, StridedSliceDescriptor::m_Stride, ReshapeDescriptor::m_TargetShape, armnn::NHWC, options, TensorInfo::SetShape(), IOutputSlot::SetTensorInfo(), armnnDeserializer::ToTensorInfo(), and true.
Referenced by BOOST_FIXTURE_TEST_CASE(), and TfLiteParser::~TfLiteParser().