aboutsummaryrefslogtreecommitdiff
path: root/include/armnnOnnxParser/IOnnxParser.hpp
blob: f9d692738d5267187ec605002f41dd726f2bffc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once

#include <armnn/INetwork.hpp>
#include <armnn/Tensor.hpp>

#include <memory>
#include <vector>
#include <map>

namespace armnnOnnxParser
{

using BindingPointInfo = armnn::BindingPointInfo;

class OnnxParserImpl;
class IOnnxParser;
using IOnnxParserPtr = std::unique_ptr<IOnnxParser, void(*)(IOnnxParser* parser)>;

class IOnnxParser
{
public:
    static IOnnxParser* CreateRaw();
    static IOnnxParserPtr Create();
    static void Destroy(IOnnxParser* parser);

    /// Create the network from a protobuf binary file on disk
    armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile);

    /// Create the network from a protobuf text file on disk
    armnn::INetworkPtr CreateNetworkFromTextFile(const char* graphFile);

    /// Create the network directly from protobuf text in a string. Useful for debugging/testing
    armnn::INetworkPtr CreateNetworkFromString(const std::string& protoText);

    /// Retrieve binding info (layer id and tensor info) for the network input identified by the given layer name
    BindingPointInfo GetNetworkInputBindingInfo(const std::string& name) const;

    /// Retrieve binding info (layer id and tensor info) for the network output identified by the given layer name
    BindingPointInfo GetNetworkOutputBindingInfo(const std::string& name) const;

private:
    IOnnxParser();
    ~IOnnxParser();

    std::unique_ptr<OnnxParserImpl> pOnnxParserImpl;
  };

  }