blob: f9d692738d5267187ec605002f41dd726f2bffc6 [file] [log] [blame]
telsoa01c577f2c2018-08-31 09:22:23 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa01c577f2c2018-08-31 09:22:23 +01004//
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
14namespace armnnOnnxParser
15{
16
Jim Flynnb4d7eae2019-05-01 14:44:27 +010017using BindingPointInfo = armnn::BindingPointInfo;
telsoa01c577f2c2018-08-31 09:22:23 +010018
Kevin Mayef33cb12021-01-29 14:24:57 +000019class OnnxParserImpl;
telsoa01c577f2c2018-08-31 09:22:23 +010020class IOnnxParser;
21using IOnnxParserPtr = std::unique_ptr<IOnnxParser, void(*)(IOnnxParser* parser)>;
22
23class IOnnxParser
24{
25public:
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
Kevin Mayef33cb12021-01-29 14:24:57 +000031 armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile);
telsoa01c577f2c2018-08-31 09:22:23 +010032
33 /// Create the network from a protobuf text file on disk
Kevin Mayef33cb12021-01-29 14:24:57 +000034 armnn::INetworkPtr CreateNetworkFromTextFile(const char* graphFile);
telsoa01c577f2c2018-08-31 09:22:23 +010035
36 /// Create the network directly from protobuf text in a string. Useful for debugging/testing
Kevin Mayef33cb12021-01-29 14:24:57 +000037 armnn::INetworkPtr CreateNetworkFromString(const std::string& protoText);
telsoa01c577f2c2018-08-31 09:22:23 +010038
39 /// Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name
Kevin Mayef33cb12021-01-29 14:24:57 +000040 BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const;
telsoa01c577f2c2018-08-31 09:22:23 +010041
42 /// Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name
Kevin Mayef33cb12021-01-29 14:24:57 +000043 BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const;
telsoa01c577f2c2018-08-31 09:22:23 +010044
Kevin Mayef33cb12021-01-29 14:24:57 +000045private:
46 IOnnxParser();
47 ~IOnnxParser();
48
49 std::unique_ptr<OnnxParserImpl> pOnnxParserImpl;
telsoa01c577f2c2018-08-31 09:22:23 +010050 };
51
52 }