From 40fd1858a283ade9c65ef0e99f7df97ddb988a25 Mon Sep 17 00:00:00 2001 From: Mikhail Letavin Date: Wed, 9 Sep 2020 17:21:10 +0300 Subject: [PATCH] [IE CLDNN] Fix problems with loop iterator and parameter check in clDNN (#2141) --- inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp | 2 +- inference-engine/thirdparty/clDNN/src/scatter_update.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp b/inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp index 8383fdf..526609f 100644 --- a/inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp +++ b/inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp @@ -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++; } diff --git a/inference-engine/thirdparty/clDNN/src/scatter_update.cpp b/inference-engine/thirdparty/clDNN/src/scatter_update.cpp index 2c4dca9..8bc7a96 100644 --- a/inference-engine/thirdparty/clDNN/src/scatter_update.cpp +++ b/inference-engine/thirdparty/clDNN/src/scatter_update.cpp @@ -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(axis) < 0 || static_cast(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(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(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(axis) < 0 || static_cast(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}; } -- 2.7.4