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 | |
| 16 | namespace armnnDeserializeParser |
| 17 | { |
| 18 | |
| 19 | using BindingPointInfo = std::pair<armnn::LayerBindingId, armnn::TensorInfo>; |
| 20 | |
| 21 | class IDeserializeParser; |
| 22 | using IDeserializeParserPtr = std::unique_ptr<IDeserializeParser, void(*)(IDeserializeParser* parser)>; |
| 23 | |
| 24 | class IDeserializeParser |
| 25 | { |
| 26 | public: |
| 27 | static IDeserializeParser* CreateRaw(); |
| 28 | static IDeserializeParserPtr Create(); |
| 29 | static void Destroy(IDeserializeParser* parser); |
| 30 | |
Derek Lamberti | 2b183fb | 2019-02-18 16:36:57 +0000 | [diff] [blame^] | 31 | /// Create an input network from binary file contents |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 32 | virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent) = 0; |
| 33 | |
Derek Lamberti | 2b183fb | 2019-02-18 16:36:57 +0000 | [diff] [blame^] | 34 | /// Create an input network from a binary input stream |
| 35 | virtual armnn::INetworkPtr CreateNetworkFromBinary(std::istream& binaryContent) = 0; |
Kevin May | 43a799c | 2019-02-08 16:31:42 +0000 | [diff] [blame] | 36 | |
| 37 | /// Retrieve binding info (layer id and tensor info) for the network input identified by |
| 38 | /// the given layer name and layers id |
| 39 | virtual BindingPointInfo GetNetworkInputBindingInfo(unsigned int layerId, |
| 40 | const std::string& name) const = 0; |
| 41 | |
| 42 | /// Retrieve binding info (layer id and tensor info) for the network output identified by |
| 43 | /// the given layer name and layers id |
| 44 | virtual BindingPointInfo GetNetworkOutputBindingInfo(unsigned int layerId, |
| 45 | const std::string& name) const = 0; |
| 46 | |
| 47 | protected: |
| 48 | virtual ~IDeserializeParser() {}; |
| 49 | |
| 50 | }; |
| 51 | } |