| 275 | |
| 276 | template<typename Delegate> |
| 277 | void ForEachLayerInput(LayerSelectionInfo::LayerInfoContainer& layerInfos, |
| 278 | LayerSelectionInfo& layerInfo, |
| 279 | Delegate function) |
| 280 | { |
| 281 | Layer& layer = *PolymorphicDowncast<Layer*>(layerInfo.m_Layer); |
| 282 | |
| 283 | for (auto inputSlot : layer.GetInputSlots()) |
| 284 | { |
| 285 | auto connectedInput = PolymorphicDowncast<OutputSlot*>(inputSlot.GetConnection()); |
| 286 | if (!connectedInput) |
| 287 | { |
| 288 | throw armnn::Exception("Dangling input slot detected."); |
| 289 | } |
| 290 | Layer& inputLayer = connectedInput->GetOwningLayer(); |
| 291 | |
| 292 | auto parentInfo = layerInfos.find(&inputLayer); |
| 293 | if (parentInfo != layerInfos.end()) |
| 294 | { |
| 295 | function(parentInfo->second); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | template<typename Delegate> |
| 301 | void ForEachLayerOutput(LayerSelectionInfo::LayerInfoContainer& layerInfos, |
no test coverage detected