aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/SubGraphSelector.hpp
diff options
context:
space:
mode:
authorDavid Beck <david.beck@arm.com>2018-10-26 16:03:03 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2018-10-26 16:40:49 +0000
commitf98d21a244c384c5942e4b261d168f65ecc8a797 (patch)
tree65de8992145a7c2801d9b626f61f2ec6ebbf7003 /src/armnn/SubGraphSelector.hpp
parent5f70318b08907eb1612dbe88d53857110909cb42 (diff)
downloadarmnn-f98d21a244c384c5942e4b261d168f65ecc8a797.tar.gz
IVGCVSW-1896 : SubGraph selector
Change-Id: Iae9a76b10d84d7ba80136b54355f8d37d2df475d
Diffstat (limited to 'src/armnn/SubGraphSelector.hpp')
-rw-r--r--src/armnn/SubGraphSelector.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/armnn/SubGraphSelector.hpp b/src/armnn/SubGraphSelector.hpp
new file mode 100644
index 0000000000..f96b986a2e
--- /dev/null
+++ b/src/armnn/SubGraphSelector.hpp
@@ -0,0 +1,40 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#pragma once
+
+#include "SubGraph.hpp"
+#include <functional>
+#include <memory>
+
+namespace armnn
+{
+
+class Layer;
+class Graph;
+
+class SubGraphSelector final
+{
+public:
+ using SubGraphPtr = std::unique_ptr<SubGraph>;
+ using SubGraphs = std::vector<SubGraphPtr>;
+ using LayerSelectorFunction = std::function<bool(const Layer&)>;
+
+ /// Selects subgraphs of a graph based on the selector function
+ /// and the algorithm. Since the SubGraphs returns modifiable pointers
+ /// the input and output slots of the graph:
+ /// 1) the graph cannot be const
+ /// 2) the caller need to make sure that the SubGraphs lifetime is
+ /// shorter than the graph's
+ static SubGraphs SelectSubGraphs(Graph& graph,
+ const LayerSelectorFunction& selector);
+
+private:
+ // this is a utility class, don't construct or copy
+ SubGraphSelector() = delete;
+ SubGraphSelector(const SubGraphSelector&) = delete;
+ SubGraphSelector & operator=(const SubGraphSelector&) = delete;
+};
+
+} // namespace armnn