diff --git a/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/infer/deconv2d_infer.c b/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/infer/deconv2d_infer.c index a40c8896ce7..9a7dc9977c7 100644 --- a/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/infer/deconv2d_infer.c +++ b/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/infer/deconv2d_infer.c @@ -54,6 +54,8 @@ int Deconv2dInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC int kernel_w = param->kernel_w_ != -1 ? param->kernel_w_ : GetWidth(weight); int kernel_h = param->kernel_h_ != -1 ? param->kernel_h_ : GetHeight(weight); + MS_CHECK_FALSE(kernel_w <= 0, NNACL_ERR); + MS_CHECK_FALSE(kernel_h <= 0, NNACL_ERR); MS_CHECK_FALSE(INT_MUL_OVERFLOW(kernel_h, kernel_w), NNACL_ERR); int stride_w = param->stride_w_; diff --git a/mindspore/lite/src/ops/populate/deconv2d_populate.cc b/mindspore/lite/src/ops/populate/deconv2d_populate.cc index edb74396bb8..2e3b37ab7c8 100644 --- a/mindspore/lite/src/ops/populate/deconv2d_populate.cc +++ b/mindspore/lite/src/ops/populate/deconv2d_populate.cc @@ -28,8 +28,12 @@ int SetPadAndAct(schema::PadMode pad_mode, schema::ActivationType act_type, Conv case schema::PadMode_VALID: param->pad_mode_ = Pad_valid; break; - default: + case schema::PadMode_PAD: param->pad_mode_ = Pad_pad; + break; + default: + MS_LOG(ERROR) << "pad mode does not support, " << pad_mode; + return RET_NOT_SUPPORT; } switch (act_type) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc index 6f31ae53c3c..c7cbed6b7ca 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc @@ -89,7 +89,7 @@ int GatherNdCPUKernel::InitOffset() { return RET_ERROR; } auto indices_ptr = reinterpret_cast(indices_tensor->data()); - MS_ASSERT(indices_ptr != nullptr); + MS_CHECK_TRUE_MSG(indices_ptr != nullptr, RET_ERROR, "indices_ptr is nullptr."); area_ = 1; for (int i = idx_lastshape; i < in_rank; ++i) { area_ *= in_shape[i]; diff --git a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc index 5bdb663103c..5b3f7e4d903 100644 --- a/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc +++ b/mindspore/lite/tools/converter/legacy_optimizer/graph/infershape_pass.cc @@ -227,6 +227,7 @@ std::vector ConvertTensorToLiteTensor(const MetaGraphT *graph, const s ConvertTensorList(graph, tensor_index, &convert_succ, &lite_tensors); break; case kObjectTypeString: + MS_CHECK_TRUE_MSG(tensorT->dims.size() <= 1, {}, "String type tensor dims should be less than or equal to 1."); ConvertString(graph, tensor_index, &convert_succ, &lite_tensors); break; default: