ArmNN
 21.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 TfLiteParserImpl;
23 class ITfLiteParser;
24 using ITfLiteParserPtr = std::unique_ptr<ITfLiteParser, void(*)(ITfLiteParser* parser)>;
25 
27 {
28 public:
30  {
34 
37  };
38 
41  static void Destroy(ITfLiteParser* parser);
42 
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  /// Retrieve binding info (layer id and tensor info) for the network input identified by
50  /// the given layer name and subgraph id
52  const std::string& name) const;
53 
54  /// Retrieve binding info (layer id and tensor info) for the network output identified by
55  /// the given layer name and subgraph id
57  const std::string& name) const;
58 
59  /// Return the number of subgraphs in the parsed model
60  size_t GetSubgraphCount() const;
61 
62  /// Return the input tensor names for a given subgraph
63  std::vector<std::string> GetSubgraphInputTensorNames(size_t subgraphId) const;
64 
65  /// Return the output tensor names for a given subgraph
66  std::vector<std::string> GetSubgraphOutputTensorNames(size_t subgraphId) const;
67 
68 private:
70  ~ITfLiteParser();
71 
72  std::unique_ptr<TfLiteParserImpl> pTfLiteParserImpl;
73 };
74 
75 }
DataLayout::NCHW false
std::vector< std::string > GetSubgraphOutputTensorNames(size_t subgraphId) const
Return the output tensor names for a given subgraph.
armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile)
Create the network from a flatbuffers binary file on disk.
size_t GetSubgraphCount() const
Return the number of subgraphs in the parsed model.
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 ...
std::unique_ptr< ITfLiteParser, void(*)(ITfLiteParser *parser)> ITfLiteParserPtr
static ITfLiteParserPtr Create(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
static void Destroy(ITfLiteParser *parser)
static ITfLiteParser * CreateRaw(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
armnn::INetworkPtr CreateNetworkFromBinary(const std::vector< uint8_t > &binaryContent)
Create the network from a flatbuffers binary.
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:261
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...
armnn::BindingPointInfo BindingPointInfo
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
std::vector< std::string > GetSubgraphInputTensorNames(size_t subgraphId) const
Return the input tensor names for a given subgraph.