| 1096 | } |
| 1097 | |
| 1098 | void IDeserializer::DeserializerImpl::SetupOutputLayers(GraphPtr graph) |
| 1099 | { |
| 1100 | CHECK_GRAPH(graph, 0); |
| 1101 | const unsigned int numOutputs = graph->outputIds()->size(); |
| 1102 | m_OutputBindings.clear(); |
| 1103 | m_OutputBindings.reserve(numOutputs); |
| 1104 | |
| 1105 | for (unsigned int i = 0; i < numOutputs; i++) |
| 1106 | { |
| 1107 | unsigned int outputLayerIndex = 0xFFFFFFFF; |
| 1108 | if (GetFeatureVersions(graph).m_BindingIdScheme == 0) |
| 1109 | { |
| 1110 | const unsigned int outputId = armnn::numeric_cast<unsigned int>(graph->outputIds()->Get(i)); |
| 1111 | outputLayerIndex = GetLayerIndexInVector(graph, outputId); |
| 1112 | } |
| 1113 | else |
| 1114 | { |
| 1115 | const int outputId = graph->outputIds()->Get(i); |
| 1116 | outputLayerIndex = GetOutputLayerInVector(graph, outputId); |
| 1117 | } |
| 1118 | |
| 1119 | LayerBaseRawPtr baseLayer = GetBaseLayer(graph, outputLayerIndex); |
| 1120 | |
| 1121 | // GetBindingLayerInfo expect the index to be index in the vector not index property on each layer base |
| 1122 | LayerBindingId bindingId = GetBindingLayerInfo(graph, outputLayerIndex); |
| 1123 | if (baseLayer->layerName()->c_str() == nullptr) |
| 1124 | { |
| 1125 | throw ParseException(fmt::format("Output with layer index [{0}] has no name", outputLayerIndex)); |
| 1126 | } |
| 1127 | |
| 1128 | IConnectableLayer* outputLayer = |
| 1129 | m_Network->AddOutputLayer(bindingId, baseLayer->layerName()->c_str()); |
| 1130 | |
| 1131 | RegisterInputSlots(graph, outputLayerIndex, outputLayer); |
| 1132 | unsigned int sourceLayerIndex = |
| 1133 | GetLayerIndexInVector(graph, baseLayer->inputSlots()->Get(0)->connection()->sourceLayerIndex()); |
| 1134 | unsigned int outputSlotIndex = |
| 1135 | GetLayerIndexInVector(graph, baseLayer->inputSlots()->Get(0)->connection()->outputSlotIndex()); |
| 1136 | LayerBaseRawPtr sourceBaseLayer = GetBaseLayer(graph, sourceLayerIndex); |
| 1137 | const armnn::TensorInfo& tensorInfo = ToTensorInfo( |
| 1138 | sourceBaseLayer->outputSlots()->Get(outputSlotIndex)->tensorInfo()); |
| 1139 | BindingPointInfo bindingInfo = {bindingId, tensorInfo}; |
| 1140 | m_OutputBindings.push_back(std::make_pair(baseLayer->layerName()->c_str(), bindingInfo)); |
| 1141 | } |
| 1142 | } |
| 1143 | |
| 1144 | void IDeserializer::DeserializerImpl::RegisterOutputSlots(GraphPtr graph, |
| 1145 | uint32_t layerIndex, |
nothing calls this directly
no test coverage detected