[GNA] Properly obtain all subsequent layers for memory layer connection (#21602)

This commit is contained in:
Tomasz Adamowicz 2023-12-13 08:55:32 +01:00 committed by GitHub
parent ef14b50d79
commit 9fe38f1a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2404,22 +2404,15 @@ void GNAGraphCompiler::connectOutput(InferenceEngine::CNNLayerPtr layer, void* p
log::debug() << "Connecting output " << layer->name << " ...\n";
// in case of Memory Layer it's input allocated in meminput layer
if (layer->outData.size() == 1) {
for (int j = 0; j != static_cast<int>(getInputTo(layer->outData.front()).size()); j++) {
auto isNonFunctional = [](CNNLayerPtr l) {
return LayerInfo(l).isNonFunctional();
};
auto isNonFunctional = [](CNNLayerPtr l) {
return LayerInfo(l).isNonFunctional();
};
if (!CNNNetHasNextLayerSkipCertain(layer, 0, j, isNonFunctional)) {
continue;
}
auto nextLayer = CNNNetGetNextLayerSkipCertain(layer, 0, j, isNonFunctional);
if (!nextLayer.first) {
log::debug() << "for layer: " << layer->name << "outData[0] has non functional connection at " << j;
}
auto next_layers = CNNNetGetAllNextLayersSkipCertain(layer, -1, isNonFunctional);
for (auto& next_layer : next_layers) {
auto nextMemoryLayerIt =
std::find_if(begin(memory_connection), end(memory_connection), [&](MemoryConnection::value_type& comp) {
return comp.second.getOutput()->name == nextLayer.first->name;
return comp.second.getOutput()->name == next_layer->name;
});
if (nextMemoryLayerIt != memory_connection.end()) {
auto& nextMemoryLayer = nextMemoryLayerIt->second;