ArmNN
 21.02
IOnnxParser.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/INetwork.hpp>
8 #include <armnn/Tensor.hpp>
9 
10 #include <memory>
11 #include <vector>
12 #include <map>
13 
14 namespace armnnOnnxParser
15 {
16 
18 
19 class OnnxParserImpl;
20 class IOnnxParser;
21 using IOnnxParserPtr = std::unique_ptr<IOnnxParser, void(*)(IOnnxParser* parser)>;
22 
24 {
25 public:
26  static IOnnxParser* CreateRaw();
27  static IOnnxParserPtr Create();
28  static void Destroy(IOnnxParser* parser);
29 
30  /// Create the network from a protobuf binary file on disk
31  armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile);
32 
33  /// Create the network from a protobuf text file on disk
34  armnn::INetworkPtr CreateNetworkFromTextFile(const char* graphFile);
35 
36  /// Create the network directly from protobuf text in a string. Useful for debugging/testing
37  armnn::INetworkPtr CreateNetworkFromString(const std::string& protoText);
38 
39  /// Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name
40  BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const;
41 
42  /// Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name
43  BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const;
44 
45 private:
46  IOnnxParser();
47  ~IOnnxParser();
48 
49  std::unique_ptr<OnnxParserImpl> pOnnxParserImpl;
50  };
51 
52  }
static IOnnxParser * CreateRaw()
Definition: OnnxParser.cpp:31
armnn::INetworkPtr CreateNetworkFromString(const std::string &protoText)
Create the network directly from protobuf text in a string. Useful for debugging/testing.
Definition: OnnxParser.cpp:56
BindingPointInfo GetNetworkInputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
Definition: OnnxParser.cpp:61
armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile)
Create the network from a protobuf binary file on disk.
Definition: OnnxParser.cpp:46
armnn::INetworkPtr CreateNetworkFromTextFile(const char *graphFile)
Create the network from a protobuf text file on disk.
Definition: OnnxParser.cpp:51
static void Destroy(IOnnxParser *parser)
Definition: OnnxParser.cpp:41
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition: Tensor.hpp:261
static IOnnxParserPtr Create()
Definition: OnnxParser.cpp:36
BindingPointInfo GetNetworkOutputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer...
Definition: OnnxParser.cpp:66
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
armnn::BindingPointInfo BindingPointInfo
Definition: IOnnxParser.hpp:17
std::unique_ptr< IOnnxParser, void(*)(IOnnxParser *parser)> IOnnxParserPtr
Definition: IOnnxParser.hpp:21