diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc index 70363a6fda2..e105e2e3153 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc @@ -79,16 +79,19 @@ int ArithmeticInt8CPUKernel::Init() { auto *input0_tensor = in_tensors_.at(0); auto in0_quant_args = input0_tensor->quant_params(); + CHECK_LESS_RETURN(in0_quant_args.size(), 1); quant_args_.in0_args_.scale_ = in0_quant_args.front().scale; quant_args_.in0_args_.zp_ = in0_quant_args.front().zeroPoint; auto *input1_tensor = in_tensors_.at(1); auto in1_quant_args = input1_tensor->quant_params(); + CHECK_LESS_RETURN(in1_quant_args.size(), 1); quant_args_.in1_args_.scale_ = in1_quant_args.front().scale; quant_args_.in1_args_.zp_ = in1_quant_args.front().zeroPoint; auto *out_tensor = out_tensors_.at(kOutputIndex); auto out_quant_args = out_tensor->quant_params(); + CHECK_LESS_RETURN(out_quant_args.size(), 1); quant_args_.out_args_.scale_ = out_quant_args.front().scale; quant_args_.out_args_.zp_ = out_quant_args.front().zeroPoint; if (!InferShapeDone()) { diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc index 2a85a2b0e21..b2ea83fd73e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc @@ -32,11 +32,13 @@ int ArithmeticSelfInt8CPUKernel::Init() { auto *input_tensor = in_tensors_.at(kInputIndex); CHECK_NULL_RETURN(input_tensor); auto in_quant_args = input_tensor->quant_params(); + CHECK_LESS_RETURN(in_quant_args.size(), 1); para_->quant_arg_.in_args_.scale_ = in_quant_args.front().scale; para_->quant_arg_.in_args_.zp_ = in_quant_args.front().zeroPoint * (-1); auto *out_tensor = out_tensors_.at(kOutputIndex); auto out_quant_args = out_tensor->quant_params(); + CHECK_LESS_RETURN(out_quant_args.size(), 1); para_->quant_arg_.out_args_.scale_ = out_quant_args.front().scale; para_->quant_arg_.out_args_.zp_ = out_quant_args.front().zeroPoint; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc index 3b3f4428ffe..0fcbf247ebf 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc @@ -94,9 +94,11 @@ int ResizeInt8CPUKernel::Init() { return RET_ERROR; } auto input = in_tensors_.at(0); + CHECK_LESS_RETURN(input->quant_params().size(), 1); quant_in_->zp_ = input->quant_params().front().zeroPoint; quant_in_->scale_ = input->quant_params().front().scale; auto output = out_tensors_.at(0); + CHECK_LESS_RETURN(output->quant_params().size(), 1); quant_out_->zp_ = output->quant_params().front().zeroPoint; quant_out_->scale_ = output->quant_params().front().scale; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc index 75d13bb1c14..671cc01f651 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc @@ -172,6 +172,9 @@ int ScaleInt8CPUKernel::InitQuantArgs() { auto input = in_tensors_.at(0); auto scale = in_tensors_.at(1); auto output = out_tensors_.at(0); + CHECK_LESS_RETURN(input->quant_params().size(), 1); + CHECK_LESS_RETURN(scale->quant_params().size(), 1); + CHECK_LESS_RETURN(output->quant_params().size(), 1); auto input_scale = input->quant_params().front().scale; auto scale_scale = scale->quant_params().front().scale; auto output_scale = output->quant_params().front().scale; @@ -188,6 +191,7 @@ int ScaleInt8CPUKernel::InitQuantArgs() { if (in_tensors_.size() == kScaleBiasInputsSize) { auto offset = in_tensors_.at(kOffsetIndex); + CHECK_LESS_RETURN(offset->quant_params().size(), 1); auto offset_scale = offset->quant_params().front().scale; scale_param_->offset_zp_ = offset->quant_params().front().zeroPoint;