aboutsummaryrefslogtreecommitdiff
path: root/include/armnnDeserializer/IDeserializer.hpp
blob: 11e098a52393b64ef4ebd90f86ac3bc1da4cd590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once

#include "armnn/Types.hpp"
#include "armnn/NetworkFwd.hpp"
#include "armnn/Tensor.hpp"
#include "armnn/INetwork.hpp"

#include <memory>
#include <map>
#include <vector>

namespace armnnDeserializer
{
using BindingPointInfo = std::pair<armnn::LayerBindingId, armnn::TensorInfo>;

class IDeserializer;
using IDeserializerPtr = std::unique_ptr<IDeserializer, void(*)(IDeserializer* parser)>;

class IDeserializer
{
public:
    static IDeserializer* CreateRaw();
    static IDeserializerPtr Create();
    static void Destroy(IDeserializer* parser);

    /// Create an input network from binary file contents
    virtual armnn::INetworkPtr CreateNetworkFromBinary(const std::vector<uint8_t>& binaryContent) = 0;

    /// Create an input network from a binary input stream
    virtual armnn::INetworkPtr CreateNetworkFromBinary(std::istream& binaryContent) = 0;

    /// Retrieve binding info (layer id and tensor info) for the network input identified by
    /// the given layer name and layers id
    virtual BindingPointInfo GetNetworkInputBindingInfo(unsigned int layerId,
                                                        const std::string& name) const = 0;

    /// Retrieve binding info (layer id and tensor info) for the network output identified by
    /// the given layer name and layers id
    virtual BindingPointInfo GetNetworkOutputBindingInfo(unsigned int layerId,
                                                         const std::string& name) const = 0;

protected:
    virtual ~IDeserializer() {};

};
} //namespace armnnDeserializer