diff --git a/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp b/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp index 7a955c9c7e3f3b..a4681bdff41e01 100644 --- a/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp +++ b/inference-engine/src/gna_plugin/layers/gna_layer_info.hpp @@ -264,7 +264,7 @@ class LayerInfo { return false; } // check dims in between - for (int j = permute.first + 1; j != permute.second; j++) { + for (int j = std::min(permute.first, permute.second) + 1; j < std::max(permute.first, permute.second); j++) { if (inputsOrderTransformed[j] != 1) { return false; }