ArmNN
 25.11
Loading...
Searching...
No Matches
IOnnxParser.hpp
Go to the documentation of this file.
1//
2// Copyright © 2017,2022,2024 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
15{
16
18
19class OnnxParserImpl;
20class IOnnxParser;
21using IOnnxParserPtr = std::unique_ptr<IOnnxParser, void(*)(IOnnxParser* parser)>;
22
23class IOnnxParser
24{
25public:
26 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
27 static IOnnxParser* CreateRaw();
28 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
29 static IOnnxParserPtr Create();
30 static void Destroy(IOnnxParser* parser);
31
32 /// Create the network from a protobuf binary vector
33 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
34 armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent);
35
36 /// Create the network from a protobuf binary vector, with inputShapes specified
37 armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent,
38 const std::map<std::string, armnn::TensorShape>& inputShapes);
39
40 /// Create the network from a protobuf binary file on disk
41 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
43
44 /// Create the network from a protobuf text file on disk
45 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
46 armnn::INetworkPtr CreateNetworkFromTextFile(const char* graphFile);
47
48 /// Create the network directly from protobuf text in a string. Useful for debugging/testing
49 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
50 armnn::INetworkPtr CreateNetworkFromString(const std::string& protoText);
51
52 /// Create the network from a protobuf binary file on disk, with inputShapes specified
53 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
55 const std::map<std::string, armnn::TensorShape>& inputShapes);
56
57 /// Create the network from a protobuf text file on disk, with inputShapes specified
58 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
60 const std::map<std::string, armnn::TensorShape>& inputShapes);
61
62 /// Create the network directly from protobuf text in a string, with inputShapes specified.
63 /// Useful for debugging/testing
64 ARMNN_DEPRECATED_MSG_REMOVAL_DATE("The ONNX Parser will be removed from Arm NN in 24.08", "24.08")
65 armnn::INetworkPtr CreateNetworkFromString(const std::string& protoText,
66 const std::map<std::string, armnn::TensorShape>& inputShapes);
67
68 /// Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name
69 BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const;
70
71 /// Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name
72 BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const;
73
74private:
75 IOnnxParser();
76 ~IOnnxParser();
77
78 std::unique_ptr<OnnxParserImpl> pOnnxParserImpl;
79 };
80
81 }
#define ARMNN_DEPRECATED_MSG_REMOVAL_DATE(message, removed_in_release)
static IOnnxParser * CreateRaw()
BindingPointInfo GetNetworkOutputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network output identified by the given layer...
armnn::INetworkPtr CreateNetworkFromBinaryFile(const char *graphFile)
Create the network from a protobuf binary file on disk.
static void Destroy(IOnnxParser *parser)
armnn::INetworkPtr CreateNetworkFromString(const std::string &protoText)
Create the network directly from protobuf text in a string. Useful for debugging/testing.
BindingPointInfo GetNetworkInputBindingInfo(const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
armnn::INetworkPtr CreateNetworkFromBinary(const std::vector< uint8_t > &binaryContent)
Create the network from a protobuf binary vector.
armnn::INetworkPtr CreateNetworkFromTextFile(const char *graphFile)
Create the network from a protobuf text file on disk.
static IOnnxParserPtr Create()
std::pair< armnn::LayerBindingId, armnn::TensorInfo > BindingPointInfo
Definition Tensor.hpp:276
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition INetwork.hpp:339
armnn::BindingPointInfo BindingPointInfo
std::unique_ptr< IOnnxParser, void(*)(IOnnxParser *parser)> IOnnxParserPtr