diff options
author | David Monahan <david.monahan@arm.com> | 2019-05-10 11:52:14 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-05-10 13:09:20 +0100 |
commit | 5200afa2742ad9cd1cda7fbce8604794c0616818 (patch) | |
tree | c12a889ebceff8618b672876a353ec13e5c4291d /src/armnn/Graph.cpp | |
parent | afe78896447a90e065df6d9b1e8753bd85525750 (diff) | |
download | armnn-5200afa2742ad9cd1cda7fbce8604794c0616818.tar.gz |
IVGCVSW-3034 Updates to SubstituteSubGraph and
ReplaceSubgraphConnections to support Graphs instead of
SubGraphViews
* Added layer iteration function to SubgraphView similar to
the Graph's one
* Updated SubstituteSubgraph to reparent the layers to the
calling graph
Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: Ib2f8e70decca4a59c53ceb127e07ef5a430d1005
Diffstat (limited to 'src/armnn/Graph.cpp')
-rw-r--r-- | src/armnn/Graph.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/armnn/Graph.cpp b/src/armnn/Graph.cpp index 8c2b232ead..31ca55cb9d 100644 --- a/src/armnn/Graph.cpp +++ b/src/armnn/Graph.cpp @@ -308,6 +308,17 @@ void Graph::SubstituteSubgraph(SubgraphView& subgraph, IConnectableLayer* substi void Graph::SubstituteSubgraph(SubgraphView& subgraph, const SubgraphView& substituteSubgraph) { + // Look through each layer in the new subgraph and add any that are not already a member of this graph + substituteSubgraph.ForEachLayer([this](Layer* layer) + { + if (std::find(std::begin(m_Layers), std::end(m_Layers), layer) == std::end(m_Layers)) + { + layer->Reparent(*this, m_Layers.end()); + m_LayersInOrder = false; + } + }); + + TopologicalSort(); ReplaceSubgraphConnections(subgraph, substituteSubgraph); EraseSubgraphLayers(subgraph); } |