[IE CLDNN] Fix problems with loop iterator and parameter check in clDNN (#2141)
authorMikhail Letavin <mikhail.letavin@intel.com>
Wed, 9 Sep 2020 14:21:10 +0000 (17:21 +0300)
committerGitHub <noreply@github.com>
Wed, 9 Sep 2020 14:21:10 +0000 (17:21 +0300)
inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp
inference-engine/thirdparty/clDNN/src/scatter_update.cpp

index 8383fdf..526609f 100644 (file)
@@ -106,7 +106,7 @@ int driver_dev_id()
     auto id_itr = result.begin();
     while (id_itr != result.end()) {
         if (std::find(unused_ids.begin(), unused_ids.end(), *id_itr) != unused_ids.end())
-            result.erase(id_itr);
+            id_itr = result.erase(id_itr);
         else
             id_itr++;
     }
index 2c4dca9..8bc7a96 100644 (file)
@@ -69,18 +69,18 @@ layout scatter_update_inst::calc_output_layout(scatter_update_node const& node)
         output_type = node.get_fused_output_layout().data_type;
     }
 
+    if (static_cast<size_t>(axis) < 0 || static_cast<size_t>(axis) >= input_number_of_dims)
+        CLDNN_ERROR_MESSAGE(node.id(), "Incorrect axis value for ScatterUpdate: Axis must be positive and less than the input tensor dimension.");
+
     if (indices_size > static_cast<size_t>(output_shape.sizes()[axis])) {
         CLDNN_ERROR_MESSAGE(node.id(),
             "Undefined behavior ScatterUpdate: indices size must not be larger than the output size along the Axis.");
     }
-    
+
     if (nonempty_indices_dims + static_cast<size_t>(axis) > updates_number_of_dims) {
         CLDNN_ERROR_MESSAGE(node.id(),
             "Undefined behavior ScatterUpdate: indices dimention must not be larger than the updates[:Axis] dimentional size.");
     }
-    
-    if (static_cast<size_t>(axis) < 0 || static_cast<size_t>(axis) >= input_number_of_dims)
-        CLDNN_ERROR_MESSAGE(node.id(), "Incorrect axis value for ScatterUpdate: Axis must be positive and less than the input tensor dimension.");
 
     return layout{output_type, input_format, output_shape};
 }