MCPcopy Create free account
hub / github.com/ARM-software/armnn / InsertDebugLayerAfter

Function InsertDebugLayerAfter

src/armnn/NetworkUtils.cpp:112–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112std::vector<DebugLayer*> InsertDebugLayerAfter(Graph& graph, Layer& layer, bool toFile)
113{
114 std::vector<DebugLayer*> debugLayers;
115 debugLayers.reserve(layer.GetNumOutputSlots());
116
117 // Connect a DebugLayer to each output slot of the layer
118 uint32_t outputSlotIdx = 0;
119 for (auto outputSlot = layer.BeginOutputSlots(); outputSlot != layer.EndOutputSlots(); ++outputSlot)
120 {
121 const std::string debugName = std::string("DebugLayerAfter") + layer.GetNameStr() + "_" +
122 std::to_string(outputSlotIdx);
123
124 DebugLayer* debugLayer =
125 graph.InsertNewLayer<DebugLayer>(*outputSlot, debugName.c_str(), toFile);
126
127 // Sets output tensor info for the debug layer.
128 if (debugLayer->GetInputSlot(0).GetConnectedOutputSlot() != &(*outputSlot))
129 {
130 throw armnn::Exception("unable to set output tensor info for the debug layer.");
131 }
132
133 TensorInfo debugInfo = debugLayer->GetInputSlot(0).GetConnectedOutputSlot()->GetTensorInfo();
134
135 debugLayer->GetOutputSlot().SetTensorInfo(debugInfo);
136
137 // NOTE: It is OK to do this because DebugLayer is only supported on CpuRef
138 debugLayer->SetBackendId(Compute::CpuRef);
139
140 debugLayers.emplace_back(debugLayer);
141
142 ++outputSlotIdx;
143 }
144
145 return debugLayers;
146}
147
148} // namespace armnn

Callers 2

RunMethod · 0.85
RunMethod · 0.85

Calls 11

BeginOutputSlotsMethod · 0.80
EndOutputSlotsMethod · 0.80
GetOutputSlotMethod · 0.80
to_stringFunction · 0.50
ExceptionClass · 0.50
reserveMethod · 0.45
GetNumOutputSlotsMethod · 0.45
c_strMethod · 0.45
SetTensorInfoMethod · 0.45
SetBackendIdMethod · 0.45

Tested by

no test coverage detected