ArmNN
 25.11
Loading...
Searching...
No Matches
ITfLiteParser.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/Types.hpp"
9#include "armnn/Tensor.hpp"
10#include "armnn/INetwork.hpp"
11#include "armnn/Optional.hpp"
12
13#include <memory>
14#include <map>
15#include <vector>
16
18{
19
21
23class ITfLiteParser;
24using ITfLiteParserPtr = std::unique_ptr<ITfLiteParser, void(*)(ITfLiteParser* parser)>;
25
26class ITfLiteParser
27{
28public:
40
41 static ITfLiteParser* CreateRaw(const armnn::Optional<TfLiteParserOptions>& options = armnn::EmptyOptional());
43 static void Destroy(ITfLiteParser* parser);
44
45 /// Create the network from a flatbuffers binary file on disk
47
48 /// Create the network from a flatbuffers binary
49 armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t> & binaryContent);
50
51 /// Retrieve binding info (layer id and tensor info) for the network input identified by
52 /// the given layer name and subgraph id
54 const std::string& name) const;
55
56 /// Retrieve binding info (layer id and tensor info) for the network output identified by
57 /// the given layer name and subgraph id
59 const std::string& name) const;
60
61 /// Return the number of subgraphs in the parsed model
62 size_t GetSubgraphCount() const;
63
64 /// Return the input tensor names for a given subgraph
65 std::vector<std::string> GetSubgraphInputTensorNames(size_t subgraphId) const;
66
67 /// Return the output tensor names for a given subgraph
68 std::vector<std::string> GetSubgraphOutputTensorNames(size_t subgraphId) const;
69
70private:
71 ITfLiteParser(const armnn::Optional<TfLiteParserOptions>& options = armnn::EmptyOptional());
72 ~ITfLiteParser();
73
74 std::unique_ptr<TfLiteParserImpl> pTfLiteParserImpl;
75};
76
77}
size_t GetSubgraphCount() const
Return the number of subgraphs in the parsed model.
static void Destroy(ITfLiteParser *parser)
BindingPointInfo GetNetworkOutputBindingInfo(size_t subgraphId, 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 flatbuffers binary file on disk.
BindingPointInfo GetNetworkInputBindingInfo(size_t subgraphId, const std::string &name) const
Retrieve binding info (layer id and tensor info) for the network input identified by the given layer ...
std::vector< std::string > GetSubgraphOutputTensorNames(size_t subgraphId) const
Return the output tensor names for a given subgraph.
static ITfLiteParserPtr Create(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
armnn::INetworkPtr CreateNetworkFromBinary(const std::vector< uint8_t > &binaryContent)
Create the network from a flatbuffers binary.
static ITfLiteParser * CreateRaw(const armnn::Optional< TfLiteParserOptions > &options=armnn::EmptyOptional())
std::vector< std::string > GetSubgraphInputTensorNames(size_t subgraphId) const
Return the input tensor names for a given subgraph.
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< ITfLiteParser, void(*)(ITfLiteParser *parser)> ITfLiteParserPtr
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition Optional.hpp:32