blob: 312bb115ebad5cd1adf3098b4ab9ebbf65247977 [file] [log] [blame]
David Beckf98d21a2018-10-26 16:03:03 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include "Layer.hpp"
9
10#include <vector>
11#include <unordered_set>
12
13namespace armnn
14{
15
16///
17/// The SubGraph class represents a subgraph of a Graph.
18/// The data it holds, points to data held by layers of the Graph, so the
19/// the contents of the SubGraph becomes invalid when the Layers are destroyed
20/// or changed.
21///
22class SubGraph final
23{
24public:
25 using InputSlots = std::vector<InputSlot *>;
26 using OutputSlots = std::vector<OutputSlot *>;
27 using Layers = std::unordered_set<Layer *>;
28
29 SubGraph();
30 SubGraph(InputSlots && inputs,
31 OutputSlots && outputs,
32 Layers && layers);
33
34 const InputSlots & GetInputSlots() const;
35 const OutputSlots & GetOutputSlots() const;
36 const Layers & GetLayers() const;
37
38 const InputSlot* GetInputSlot(unsigned int index) const;
39 InputSlot* GetInputSlot(unsigned int index);
40
41 const OutputSlot* GetOutputSlot(unsigned int index) const;
42 OutputSlot* GetOutputSlot(unsigned int index);
43
44 unsigned int GetNumInputSlots() const;
45 unsigned int GetNumOutputSlots() const;
46
47private:
48 InputSlots m_InputSlots;
49 OutputSlots m_OutputSlots;
50 Layers m_Layers;
51};
52
53} // namespace armnn