From b4e01140a2e26156f84334f756f168bb196b0c4b Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Sat, 27 Nov 2021 15:54:51 +0800 Subject: [PATCH] transpose resize bug --- mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc index 0a26238cd06..49bed4e0d43 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc @@ -58,6 +58,11 @@ int TransposeInt8CPUKernel::ReSize() { int *perm_data = reinterpret_cast(perm_tensor->data()); CHECK_NULL_RETURN(perm_data); transpose_param_->num_axes_ = perm_tensor->ElementsNum(); + if (in_shape.size() != static_cast(perm_tensor->ElementsNum())) { + MS_LOG(ERROR) << "in_shape size" << in_shape.size() << "is not equal perm element" << perm_tensor->ElementsNum(); + return RET_ERROR; + } + for (int i = 0; i < transpose_param_->num_axes_; ++i) { transpose_param_->perm_[i] = perm_data[i]; }