diff options
author | Cathal Corbett <cathal.corbett@arm.com> | 2021-12-13 13:03:22 +0000 |
---|---|---|
committer | Cathal Corbett <cathal.corbett@arm.com> | 2021-12-14 14:09:55 +0000 |
commit | 18655b8d326f6109c6fedacf42b46dc4bc942324 (patch) | |
tree | 79a4cff6e46ea41f404a693ac3a9de2787498f06 /src/armnn/Graph.cpp | |
parent | a097d2a0ed8e30d5aaf6d29ec18d0c39201b7b67 (diff) | |
download | armnn-18655b8d326f6109c6fedacf42b46dc4bc942324.tar.gz |
IVGCVSW-6630 Add new method AddPrecompiledLayer() to INetwork
* Add new method AddPrecompiledLayer() to INetwork
with Comments noting it is for backend users.
* Added unit test to SubgraphViewTests.cpp.
* Bug fix and code refactor in Graph.cpp specifically around
Graph::SubstituteSubgraph(SubgraphView& subgraph,
IConnectableLayer* substituteLayer)
Change-Id: If2d816e5109e48ce920bf92d8823b39130c23a16
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Diffstat (limited to 'src/armnn/Graph.cpp')
-rw-r--r-- | src/armnn/Graph.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/armnn/Graph.cpp b/src/armnn/Graph.cpp index 0591bea99a..6d24e50bdc 100644 --- a/src/armnn/Graph.cpp +++ b/src/armnn/Graph.cpp @@ -435,8 +435,11 @@ void Graph::SubstituteSubgraph(SubgraphView& subgraph, IConnectableLayer* substi { ARMNN_ASSERT(substituteLayer != nullptr); - ReplaceSubgraphConnections(subgraph, substituteLayer); - EraseSubgraphLayers(subgraph); + // Create a new sub-graph with only the given layer, using + // the given sub-graph as a reference of which parent graph to use + SubgraphView substituteSubgraph(substituteLayer); + + SubstituteSubgraph(subgraph, substituteSubgraph); } void Graph::SubstituteSubgraph(SubgraphView& subgraph, const SubgraphView& substituteSubgraph) @@ -456,16 +459,6 @@ void Graph::SubstituteSubgraph(SubgraphView& subgraph, const SubgraphView& subst TopologicalSort(); } -void Graph::ReplaceSubgraphConnections(const SubgraphView& subgraph, IConnectableLayer* substituteLayer) -{ - ARMNN_ASSERT(substituteLayer != nullptr); - - // Create a new sub-graph with only the given layer, using - // the given sub-graph as a reference of which parent graph to use - SubgraphView substituteSubgraph(substituteLayer); - ReplaceSubgraphConnections(subgraph, substituteSubgraph); -} - void Graph::ReplaceSubgraphConnections(const SubgraphView& subgraph, const SubgraphView& substituteSubgraph) { ARMNN_ASSERT_MSG(!substituteSubgraph.GetLayers().empty(), "New sub-graph used for substitution must not be empty"); |