24.08
SubgraphViewSelector.hpp
Go to the documentation of this file.
1
//
2
// Copyright © 2017, 2023 Arm Ltd and Contributors. All rights reserved.
3
// SPDX-License-Identifier: MIT
4
//
5
#pragma once
6
7
#include <
armnn/backends/SubgraphView.hpp
>
8
#include <functional>
9
#include <memory>
10
11
namespace
armnn
12
{
13
14
class
Layer;
15
class
Graph;
16
17
/// Algorithm that splits a Graph into Subgraphs based on a filtering of layers (e.g. which layers are appropriate for
18
/// a certain backend). The resulting subgraphs are guaranteed to be form a DAG (i.e. there are no dependency loops).
19
///
20
/// The algorithm aims to produce as few subgraphs as possible.
21
class
SubgraphViewSelector
final
22
{
23
public
:
24
using
Subgraphs
= std::vector<SubgraphView::SubgraphViewPtr>;
25
using
LayerSelectorFunction
= std::function<bool(
const
Layer
&)>;
26
27
/// Selects subgraphs from a graph based on the selector function and the algorithm.
28
/// Since the Subgraphs object returns modifiable pointers to the input and output slots of the graph:
29
/// 1) the graph/sub-graph cannot be const
30
/// 2) the caller needs to make sure that the Subgraphs lifetime is shorter than the parent graph's
31
static
Subgraphs
SelectSubgraphs
(
Graph
& graph,
const
LayerSelectorFunction
& selector);
32
static
Subgraphs
SelectSubgraphs
(
SubgraphView
& subgraph,
const
LayerSelectorFunction
& selector);
33
34
private
:
35
// this is a utility class, don't construct or copy
36
SubgraphViewSelector
() =
delete
;
37
SubgraphViewSelector
(
const
SubgraphViewSelector
&) =
delete
;
38
SubgraphViewSelector
& operator=(
const
SubgraphViewSelector
&) =
delete
;
39
};
40
41
}
// namespace armnn
armnn::Layer
Definition:
Layer.hpp:230
armnn::SubgraphViewSelector
Algorithm that splits a Graph into Subgraphs based on a filtering of layers (e.g.
Definition:
SubgraphViewSelector.hpp:21
armnn::SubgraphViewSelector::SelectSubgraphs
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
Definition:
SubgraphViewSelector.cpp:269
armnn::SubgraphViewSelector::LayerSelectorFunction
std::function< bool(const Layer &)> LayerSelectorFunction
Definition:
SubgraphViewSelector.hpp:25
armnn::SubgraphView
The SubgraphView class represents a subgraph of a Graph.
Definition:
SubgraphView.hpp:31
SubgraphView.hpp
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition:
01_00_quick_start.dox:6
armnn::SubgraphViewSelector::Subgraphs
std::vector< SubgraphView::SubgraphViewPtr > Subgraphs
Definition:
SubgraphViewSelector.hpp:24
armnn::Graph
Definition:
Graph.hpp:30
src
armnn
SubgraphViewSelector.hpp
Generated on Wed Aug 28 2024 14:31:49 for Arm NN by
1.8.17