aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2021-02-18 11:50:22 +0000
committerRob Hughes <robert.hughes@arm.com>2021-02-19 09:16:05 +0000
commit0fb4c23953d4e824081e1f2f789301ec311f7fca (patch)
tree429caac23619b3cec3acbfe17f6fe3d2c3fd5231
parentea4fce735cd0ae70d6ea6a82a5550764bcf05d30 (diff)
downloadarmnn-0fb4c23953d4e824081e1f2f789301ec311f7fca.tar.gz
Give unique names to debug layers
Debug layers are given names based on the layer they take their input from. If a layer has multiple outputs then one debug layer will be attached to each output. Therefore all these debug layers would have identical names making them hard to distinguish when debugging. This patch includes the output slot index which the debug layer takes its input from when creating the name. Change-Id: I09eaa8a7edad9bfdf678b4778cf740340013126c Signed-off-by: Rob Hughes <robert.hughes@arm.com>
-rw-r--r--src/armnn/NetworkUtils.cpp6
-rw-r--r--src/backends/reference/test/RefOptimizedNetworkTests.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/armnn/NetworkUtils.cpp b/src/armnn/NetworkUtils.cpp
index 285da4c9a9..666ce3d069 100644
--- a/src/armnn/NetworkUtils.cpp
+++ b/src/armnn/NetworkUtils.cpp
@@ -237,9 +237,11 @@ std::vector<DebugLayer*> InsertDebugLayerAfter(Graph& graph, Layer& layer)
debugLayers.reserve(layer.GetNumOutputSlots());
// Connect a DebugLayer to each output slot of the layer
+ uint32_t outputSlotIdx = 0;
for (auto outputSlot = layer.BeginOutputSlots(); outputSlot != layer.EndOutputSlots(); ++outputSlot)
{
- const std::string debugName = std::string("DebugLayerAfter") + layer.GetNameStr();
+ const std::string debugName = std::string("DebugLayerAfter") + layer.GetNameStr() + "_" +
+ std::to_string(outputSlotIdx);
DebugLayer* debugLayer =
graph.InsertNewLayer<DebugLayer>(*outputSlot, debugName.c_str());
@@ -254,6 +256,8 @@ std::vector<DebugLayer*> InsertDebugLayerAfter(Graph& graph, Layer& layer)
debugLayer->SetBackendId(Compute::CpuRef);
debugLayers.emplace_back(debugLayer);
+
+ ++outputSlotIdx;
}
return debugLayers;
diff --git a/src/backends/reference/test/RefOptimizedNetworkTests.cpp b/src/backends/reference/test/RefOptimizedNetworkTests.cpp
index 086c1e471a..2f25b6cd4d 100644
--- a/src/backends/reference/test/RefOptimizedNetworkTests.cpp
+++ b/src/backends/reference/test/RefOptimizedNetworkTests.cpp
@@ -196,9 +196,9 @@ BOOST_AUTO_TEST_CASE(DebugTestOnCpuRef)
// Tests that the vertices exist and have correct names.
BOOST_TEST(GraphHasNamedLayer(graph, "InputLayer"));
- BOOST_TEST(GraphHasNamedLayer(graph, "DebugLayerAfterInputLayer"));
+ BOOST_TEST(GraphHasNamedLayer(graph, "DebugLayerAfterInputLayer_0"));
BOOST_TEST(GraphHasNamedLayer(graph, "ActivationLayer"));
- BOOST_TEST(GraphHasNamedLayer(graph, "DebugLayerAfterActivationLayer"));
+ BOOST_TEST(GraphHasNamedLayer(graph, "DebugLayerAfterActivationLayer_0"));
BOOST_TEST(GraphHasNamedLayer(graph, "OutputLayer"));
}