blob: f96b986a2e97b91cd7f2c3bcab1f9697cf5e4258 [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#pragma once
6
7#include "SubGraph.hpp"
8#include <functional>
9#include <memory>
10
11namespace armnn
12{
13
14class Layer;
15class Graph;
16
17class SubGraphSelector final
18{
19public:
20 using SubGraphPtr = std::unique_ptr<SubGraph>;
21 using SubGraphs = std::vector<SubGraphPtr>;
22 using LayerSelectorFunction = std::function<bool(const Layer&)>;
23
24 /// Selects subgraphs of a graph based on the selector function
25 /// and the algorithm. Since the SubGraphs returns modifiable pointers
26 /// the input and output slots of the graph:
27 /// 1) the graph cannot be const
28 /// 2) the caller need to make sure that the SubGraphs lifetime is
29 /// shorter than the graph's
30 static SubGraphs SelectSubGraphs(Graph& graph,
31 const LayerSelectorFunction& selector);
32
33private:
34 // this is a utility class, don't construct or copy
35 SubGraphSelector() = delete;
36 SubGraphSelector(const SubGraphSelector&) = delete;
37 SubGraphSelector & operator=(const SubGraphSelector&) = delete;
38};
39
40} // namespace armnn