NNXSW-1697 Remove use of SubgraphView that may become invalid.
The mainSubgraph variable held references to layers in the optimised
graph that become invalid when a graph substitution is made.
The fix is to always use the optimised graph itself rather than a
view of it. The view served no purpose anyway.
!android-nn-driver:1221
Change-Id: I579f503827db8f7fcb01443237c9d888d496425f
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp
index b80e0e7..0d06042 100644
--- a/src/armnn/Network.cpp
+++ b/src/armnn/Network.cpp
@@ -334,9 +334,6 @@
// Get the optimized graph
Graph& optGraph = optNetObjPtr->GetGraph();
- // Get the entire graph as a sub-graph
- SubgraphView mainSubgraph(optGraph);
-
// Run backend specific optimizations
auto const& backendRegistry = BackendRegistryInstance();
for (auto&& selectedBackend : backendSettings.m_SelectedBackends)
@@ -347,7 +344,7 @@
// Select sub-graphs based on backend
SubgraphViewSelector::Subgraphs subgraphs =
- SubgraphViewSelector::SelectSubgraphs(mainSubgraph,
+ SubgraphViewSelector::SelectSubgraphs(optGraph,
// Select layers assigned to the requested backend
[&backendObjPtr](const Layer& layer)
{