blob: c591876c900134b373d5591c8bb87d85700f6f48 [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/Types.hpp"
8#include "armnn/NetworkFwd.hpp"
9#include "armnn/Tensor.hpp"
10#include "armnn/INetwork.hpp"
11
12#include <memory>
13#include <map>
14#include <vector>
15
16namespace armnnTfLiteParser
17{
18
19// TODO: revise this: do we really need this for every parser???
20using BindingPointInfo = std::pair<armnn::LayerBindingId, armnn::TensorInfo>;
21
22class ITfLiteParser;
23using ITfLiteParserPtr = std::unique_ptr<ITfLiteParser, void(*)(ITfLiteParser* parser)>;
24
25class ITfLiteParser
26{
27public:
28 static ITfLiteParser* CreateRaw();
29 static ITfLiteParserPtr Create();
30 static void Destroy(ITfLiteParser* parser);
31
32 /// Create the network from a flatbuffers binary file on disk
33 virtual armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile) = 0;
34
35 /// Create the network from a flatbuffers binary
36 virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t> & binaryContent) = 0;
37
38 /// Retrieve binding info (layer id and tensor info) for the network input identified by
39 /// the given layer name and subgraph id
40 virtual BindingPointInfo GetNetworkInputBindingInfo(size_t subgraphId,
41 const std::string& name) const = 0;
42
43 /// Retrieve binding info (layer id and tensor info) for the network output identified by
44 /// the given layer name and subgraph id
45 virtual BindingPointInfo GetNetworkOutputBindingInfo(size_t subgraphId,
46 const std::string& name) const = 0;
47
48 /// Return the number of subgraphs in the parsed model
49 virtual size_t GetSubgraphCount() const = 0;
50
51 /// Return the input tensor names for a given subgraph
52 virtual std::vector<std::string> GetSubgraphInputTensorNames(size_t subgraphId) const = 0;
53
54 /// Return the output tensor names for a given subgraph
55 virtual std::vector<std::string> GetSubgraphOutputTensorNames(size_t subgraphId) const = 0;
56
57protected:
58 virtual ~ITfLiteParser() {};
59};
60
61}