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.
Change-Id: Iad75f5829597ec43a774cfd7f2e5e7dede09dfa4
diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp
index 6707cc7..a438008 100644
--- a/src/armnn/Network.cpp
+++ b/src/armnn/Network.cpp
@@ -346,9 +346,6 @@
// Get the optimized graph
Graph& optGraph = optNetObjPtr->GetGraph();
- // Get the entire graph as a sub-graph
- SubgraphView mainSubgraph(optGraph);
-
// Run backend specific optimizations
for (auto&& selectedBackend : backendSettings.m_SelectedBackends)
{
@@ -357,7 +354,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)
{