Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/plugins/intel_gna/src/gna_graph_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

if (!CNNNetHasNextLayerSkipCertain(layer, 0, j, isNonFunctional)) {
continue;
}
auto nextLayer = CNNNetGetNextLayerSkipCertain(layer, 0, j, isNonFunctional);
auto isNonFunctional = [](CNNLayerPtr l) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto isNonFunctional = [](CNNLayerPtr l) {
auto is_non_functional = [](CNNLayerPtr l) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found around 17 places in the code where such lambda is created, maybe it would be good to create such method?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I'm wondering if it makes sense to refactor at this moment, especially since we're about to introduce ngraph API here soon.

return LayerInfo(l).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;
Expand Down
Loading