Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 1 | // |
| 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 Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 16 | namespace armnnDeserializer |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 17 | { |
Derek Lamberti | 8ddae33 | 2019-02-21 16:29:43 +0000 | [diff] [blame] | 18 | struct BindingPointInfo |
| 19 | { |
| 20 | armnn::LayerBindingId m_BindingId; |
| 21 | armnn::TensorInfo m_TensorInfo; |
| 22 | }; |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 23 | |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 24 | class IDeserializer; |
| 25 | using IDeserializerPtr = std::unique_ptr<IDeserializer, void(*)(IDeserializer* parser)>; |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 26 | |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 27 | class IDeserializer |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 28 | { |
| 29 | public: |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 30 | static IDeserializer* CreateRaw(); |
| 31 | static IDeserializerPtr Create(); |
| 32 | static void Destroy(IDeserializer* parser); |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 33 | |
Derek Lamberti | 2b183fb | 2019-02-18 16:36:57 +0000 | [diff] [blame] | 34 | /// Create an input network from binary file contents |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 35 | virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent) = 0; |
| 36 | |
Derek Lamberti | 2b183fb | 2019-02-18 16:36:57 +0000 | [diff] [blame] | 37 | /// Create an input network from a binary input stream |
| 38 | virtual armnn::INetworkPtr CreateNetworkFromBinary(std::istream& binaryContent) = 0; |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 39 | |
| 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 | |
| 50 | protected: |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 51 | virtual ~IDeserializer() {}; |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 52 | |
| 53 | }; |
Derek Lamberti | 0028d1b | 2019-02-20 13:57:42 +0000 | [diff] [blame] | 54 | } //namespace armnnDeserializer |