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 | |
| 31 | /// Create the network from a flatbuffers binary file on disk |
| 32 | virtual armnn::INetworkPtr CreateNetworkFromBinaryFile(const char* graphFile) = 0; |
| 33 | |
| 34 | /// Create the network from a flatbuffers binary |
| 35 | virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent) = 0; |
| 36 | |
| 37 | |
| 38 | /// Retrieve binding info (layer id and tensor info) for the network input identified by |
| 39 | /// the given layer name and layers id |
| 40 | virtual BindingPointInfo GetNetworkInputBindingInfo(unsigned int layerId, |
| 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 layers id |
| 45 | virtual BindingPointInfo GetNetworkOutputBindingInfo(unsigned int layerId, |
| 46 | const std::string& name) const = 0; |
| 47 | |
| 48 | protected: |
| 49 | virtual ~IDeserializeParser() {}; |
| 50 | |
| 51 | }; |
| 52 | } |