ArmNN
 20.02
ITfLiteParser.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "armnn/Types.hpp"
8 #include "armnn/NetworkFwd.hpp"
9 #include "armnn/Tensor.hpp"
10 #include "armnn/INetwork.hpp"
11 #include "armnn/Optional.hpp"
12 
13 #include <memory>
14 #include <map>
15 #include <vector>
16 
18 {
19 
21 
22 class ITfLiteParser;
23 using ITfLiteParserPtr = std::unique_ptr<ITfLiteParser, void(*)(ITfLiteParser* parser)>;
24 
26 {
27 public:
29  {
32 
34  };
35 
38  static void Destroy(ITfLiteParser* parser);
39 
40  /// Create the network from a flatbuffers binary file on disk
41  virtual armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile) = 0;
42 
43  /// Create the network from a flatbuffers binary
44  virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t> & binaryContent) = 0;
45 
46  /// Retrieve binding info (layer id and tensor info) for the network input identified by
47  /// the given layer name and subgraph id
48  virtual BindingPointInfo GetNetworkInputBindingInfo(size_t subgraphId,
49  const std::string& name) const = 0;
50 
51  /// Retrieve binding info (layer id and tensor info) for the network output identified by
52  /// the given layer name and subgraph id
53  virtual BindingPointInfo GetNetworkOutputBindingInfo(size_t subgraphId,
54  const std::string& name) const = 0;
55 
56  /// Return the number of subgraphs in the parsed model
57  virtual size_t GetSubgraphCount() const = 0;
58 
59  /// Return the input tensor names for a given subgraph
60  virtual std::vector<std::string> GetSubgraphInputTensorNames(size_t subgraphId) const = 0;
61 
62  /// Return the output tensor names for a given subgraph
63  virtual std::vector<std::string> GetSubgraphOutputTensorNames(size_t subgraphId) const = 0;
64 
65 protected:
66  virtual ~ITfLiteParser() {};
67 };
68 
69 }
virtual size_t GetSubgraphCount() const =0
Return the number of subgraphs in the parsed model.
std::unique_ptr< ITfLiteParser, void(*)(ITfLiteParser *parser)> ITfLiteParserPtr
virtual std::vector< std::string > GetSubgraphInputTensorNames(size_t subgraphId) const =0
Return the input tensor names for a given subgraph.
static ITfLiteParserPtr Create(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
DataLayout::NHWC false
virtual armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile)=0
Create the network from a flatbuffers binary file on disk.
static void Destroy(ITfLiteParser *parser)
virtual std::vector< std::string > GetSubgraphOutputTensorNames(size_t subgraphId) const =0
Return the output tensor names for a given subgraph.
virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector< uint8_t > &binaryContent)=0
Create the network from a flatbuffers binary.
static ITfLiteParser * CreateRaw(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
virtual BindingPointInfo GetNetworkOutputBindingInfo(size_t subgraphId, const std::string &name) const =0
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer...
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition: Tensor.hpp:146
virtual BindingPointInfo GetNetworkInputBindingInfo(size_t subgraphId, const std::string &name) const =0
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
armnn::BindingPointInfo BindingPointInfo
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:101
armnn::Runtime::CreationOptions::ExternalProfilingOptions options