From b1a868744ce265e85f04b9745c6ba79975e2fc7c Mon Sep 17 00:00:00 2001 From: liuwenhao4 Date: Tue, 10 Nov 2020 16:51:44 +0800 Subject: [PATCH] fix resize issues of reshape and conv2d lite ops --- mindspore/lite/src/ops/conv2d.cc | 4 ++-- mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mindspore/lite/src/ops/conv2d.cc b/mindspore/lite/src/ops/conv2d.cc index 7cd97f7a52..3e663955b9 100644 --- a/mindspore/lite/src/ops/conv2d.cc +++ b/mindspore/lite/src/ops/conv2d.cc @@ -390,8 +390,8 @@ int Conv2D::InferShape(std::vector inputs_, std::vector outp this->ConvInferShape(input_h, input_w, &output_h, &output_w); std::vector out_shape{input_tensor->shape()}; - out_shape.at(1) = output_h; - out_shape.at(2) = output_w; + out_shape.at(1) = output_h > 0 ? output_h : 1; + out_shape.at(2) = output_w > 0 ? output_w : 1; out_shape.at(3) = weight_tensor->shape()[0]; out_tensor->set_shape(out_shape); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc index 3f6f3ffb49..0096c6c533 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc @@ -51,7 +51,7 @@ int ReshapeInt8CPUKernel::Init() { int ReshapeInt8CPUKernel::ReSize() { return 0; } int ReshapeInt8CPUKernel::Run() { - MS_ASSERT(in_tensors_.size() == 1); + MS_ASSERT(in_tensors_.size() == 1 || in_tensors_.size() == 2); MS_ASSERT(out_tensors_.size() == 1); input_data_ = static_cast(in_tensors_.at(kInputIndex)->MutableData()); output_data_ = static_cast(out_tensors_.at(kOutputIndex)->MutableData());