aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/SubGraph.hpp
blob: d22377dafffdb7d2bc28b6c7ad2427ca9e184666 (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
51
52
53
54
55
56
57
58
59
60
61
62
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include "Layer.hpp"

#include <vector>
#include <list>

namespace armnn
{

///
/// The SubGraph class represents a subgraph of a Graph.
/// The data it holds, points to data held by layers of the Graph, so the
/// the contents of the SubGraph becomes invalid when the Layers are destroyed
/// or changed.
///
class SubGraph final
{
public:
    using InputSlots = std::vector<InputSlot *>;
    using OutputSlots = std::vector<OutputSlot *>;
    using Layers = std::list<Layer*>;

    SubGraph();
    SubGraph(InputSlots && inputs,
             OutputSlots && outputs,
             Layers && layers);

    const InputSlots & GetInputSlots() const;
    const OutputSlots & GetOutputSlots() const;
    const Layers & GetLayers() const;

    const InputSlot* GetInputSlot(unsigned int index) const;
    InputSlot* GetInputSlot(unsigned int index);

    const OutputSlot* GetOutputSlot(unsigned int index) const;
    OutputSlot* GetOutputSlot(unsigned int index);

    unsigned int GetNumInputSlots() const;
    unsigned int GetNumOutputSlots() const;

    Layers::iterator begin();
    Layers::iterator end();

    Layers::const_iterator begin() const;
    Layers::const_iterator end() const;

    Layers::const_iterator cbegin() const;
    Layers::const_iterator cend() const;

private:
    InputSlots m_InputSlots;
    OutputSlots m_OutputSlots;
    Layers m_Layers;
};

} // namespace armnn