aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/NetworkUtils.cpp
diff options
context:
space:
mode:
authorkeidav01 <keith.davis@arm.com>2018-12-11 16:14:20 +0000
committerKeith Davis Arm <keith.davis@arm.com>2018-12-11 17:11:20 +0000
commit738c2e6a647b886750e1bc3daa6dd615a0244baa (patch)
treeef88c6a5ee1076471bd36b85c30afb36a68bbfc9 /src/armnn/NetworkUtils.cpp
parent44a7167e0f13dc1d703cd573f57636fde711c618 (diff)
downloadarmnn-738c2e6a647b886750e1bc3daa6dd615a0244baa.tar.gz
IVGCVSW-1434 Add debug mode to Optimizer
* Modified optimizer to support debug mode via DebugLayer Change-Id: Ic8f313778e55540c182cf99876c44a0823be04c6
Diffstat (limited to 'src/armnn/NetworkUtils.cpp')
-rw-r--r--src/armnn/NetworkUtils.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/armnn/NetworkUtils.cpp b/src/armnn/NetworkUtils.cpp
index 1e3add6301..9a4ce87b59 100644
--- a/src/armnn/NetworkUtils.cpp
+++ b/src/armnn/NetworkUtils.cpp
@@ -74,4 +74,33 @@ std::vector<ConvertFp32ToFp16Layer*> InsertConvertFp32ToFp16LayersAfter(Graph& g
return convertLayers;
}
+
+std::vector<DebugLayer*> InsertDebugLayerAfter(Graph& graph, Layer& layer)
+{
+ std::vector<DebugLayer*> debugLayers;
+ debugLayers.reserve(layer.GetNumOutputSlots());
+
+ // Change outputs to DataType::Float16
+ for (auto&& outputSlot = layer.BeginOutputSlots(); outputSlot != layer.EndOutputSlots(); ++outputSlot)
+ {
+ // Insert debug layer after the layer
+ const std::string name =
+ std::string("DebugLayerAfter") + layer.GetName();
+
+ const DebugDescriptor descriptor;
+
+ DebugLayer* debugLayer =
+ graph.InsertNewLayer<DebugLayer>(*outputSlot, descriptor, name.c_str());
+
+ // Sets output tensor info for the debug layer.
+ TensorInfo debugInfo = debugLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo();
+
+ debugLayer->GetOutputSlot().SetTensorInfo(debugInfo);
+
+ debugLayers.emplace_back(debugLayer);
+ }
+
+ return debugLayers;
+}
+
} // namespace armnn