aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/NetworkUtils.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-01-24 14:06:23 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-01-30 14:03:28 +0000
commitadddddb6cbcb777d92a8c464c9ad0cb9aecc76a3 (patch)
treeb15de32bf9f8612f66e1ae23d2f8009e80e7d0e6 /src/armnn/NetworkUtils.cpp
parentd089b74bebbcc8518fb0f4eacb7e6569ae170199 (diff)
downloadarmnn-adddddb6cbcb777d92a8c464c9ad0cb9aecc76a3.tar.gz
IVGCVSW-2458 Refactor the Optimize function (Network.cpp) so that
subgraphs are optimized by the backends * Added a new method OptimizeSubGraph to the backend interface * Refactored the Optimize function so that the backend-specific optimization is performed by the backend itself (through the new OptimizeSubGraph interface method) * Added a new ApplyBackendOptimizations function to apply the new changes * Added some new convenient constructors to the SubGraph class * Added AddLayer method and a pointer to the parent graph to the SubGraph class * Updated the sub-graph unit tests to match the changes * Added SelectSubGraphs and ReplaceSubGraphConnections overloads that work with sub-graphs * Removed unused code and minor refactoring where necessary Change-Id: I46181794c6a9e3b10558944f804e06a8f693a6d0
Diffstat (limited to 'src/armnn/NetworkUtils.cpp')
-rw-r--r--src/armnn/NetworkUtils.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/armnn/NetworkUtils.cpp b/src/armnn/NetworkUtils.cpp
index 735a6244d5..d0c36dd34f 100644
--- a/src/armnn/NetworkUtils.cpp
+++ b/src/armnn/NetworkUtils.cpp
@@ -111,49 +111,4 @@ std::vector<DebugLayer*> InsertDebugLayerAfter(Graph& graph, Layer& layer)
return debugLayers;
}
-PreCompiledLayer* CreatePreCompiledLayer(Graph& graph,
- const SubGraph& subGraph,
- unsigned int subGraphIndex,
- const IBackendInternalUniquePtr& backendObjPtr)
-{
- BOOST_ASSERT(backendObjPtr);
-
- IBackendInternal::ISubGraphConverterPtr converter =
- backendObjPtr->CreateSubGraphConverter(std::make_shared<SubGraph>(subGraph));
- if (!converter)
- {
- return nullptr;
- }
-
- try
- {
- // Attempt to convert and compile sub-graph
- auto preCompiledObject = converter->GetOutput();
- }
- catch (std::exception&)
- {
- return nullptr;
- }
-
- // Create pre-compiled layer
- std::string name = "pre-compiled" + std::to_string(subGraphIndex);
- PreCompiledLayer* preCompiledLayer = graph.AddLayer<PreCompiledLayer>(
- PreCompiledDescriptor(subGraph.GetNumInputSlots(), subGraph.GetNumOutputSlots()), name.c_str());
-
- // Copy output tensor infos from sub-graph
- for (unsigned int i = 0u; i < subGraph.GetNumOutputSlots(); i++)
- {
- preCompiledLayer->GetOutputSlot(i).SetTensorInfo(subGraph.GetOutputSlot(i)->GetTensorInfo());
- }
-
- // Assign pre-compiled object to layer
- preCompiledLayer->SetPreCompiledObject(converter->GetOutput());
-
- // Set the backend-id for the pre-compiled layer
- BackendId backendId = backendObjPtr->GetId();
- preCompiledLayer->SetBackendId(backendId);
-
- return preCompiledLayer;
-}
-
} // namespace armnn