blob: b2e5d10b69f73d3dba6f7bffef6ebefe8f462ee8 [file] [log] [blame]
Kevin May43a799c2019-02-08 16:31:42 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
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
Derek Lamberti0028d1b2019-02-20 13:57:42 +000016namespace armnnDeserializer
Kevin May43a799c2019-02-08 16:31:42 +000017{
Derek Lamberti8ddae332019-02-21 16:29:43 +000018struct BindingPointInfo
19{
20 armnn::LayerBindingId m_BindingId;
21 armnn::TensorInfo m_TensorInfo;
22};
Kevin May43a799c2019-02-08 16:31:42 +000023
Derek Lamberti0028d1b2019-02-20 13:57:42 +000024class IDeserializer;
25using IDeserializerPtr = std::unique_ptr<IDeserializer, void(*)(IDeserializer* parser)>;
Kevin May43a799c2019-02-08 16:31:42 +000026
Derek Lamberti0028d1b2019-02-20 13:57:42 +000027class IDeserializer
Kevin May43a799c2019-02-08 16:31:42 +000028{
29public:
Derek Lamberti0028d1b2019-02-20 13:57:42 +000030 static IDeserializer* CreateRaw();
31 static IDeserializerPtr Create();
32 static void Destroy(IDeserializer* parser);
Kevin May43a799c2019-02-08 16:31:42 +000033
Derek Lamberti2b183fb2019-02-18 16:36:57 +000034 /// Create an input network from binary file contents
Kevin May43a799c2019-02-08 16:31:42 +000035 virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent) = 0;
36
Derek Lamberti2b183fb2019-02-18 16:36:57 +000037 /// Create an input network from a binary input stream
38 virtual armnn::INetworkPtr CreateNetworkFromBinary(std::istream& binaryContent) = 0;
Kevin May43a799c2019-02-08 16:31:42 +000039
40 /// Retrieve binding info (layer id and tensor info) for the network input identified by
41 /// the given layer name and layers id
42 virtual BindingPointInfo GetNetworkInputBindingInfo(unsigned int layerId,
43 const std::string& name) const = 0;
44
45 /// Retrieve binding info (layer id and tensor info) for the network output identified by
46 /// the given layer name and layers id
47 virtual BindingPointInfo GetNetworkOutputBindingInfo(unsigned int layerId,
48 const std::string& name) const = 0;
49
50protected:
Derek Lamberti0028d1b2019-02-20 13:57:42 +000051 virtual ~IDeserializer() {};
Kevin May43a799c2019-02-08 16:31:42 +000052
53};
Derek Lamberti0028d1b2019-02-20 13:57:42 +000054} //namespace armnnDeserializer