From 820c59972b71c5660e83556b92ab25a3ee0edeb7 Mon Sep 17 00:00:00 2001 From: hangangqiang Date: Thu, 28 Jan 2021 16:02:14 +0800 Subject: [PATCH] fix resize_base bug --- mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc | 7 +++++-- mindspore/lite/src/runtime/kernel/arm/base/resize_base.h | 2 +- mindspore/lite/src/tensor.cc | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc index 535d7f721db..73c3c1f22fc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc @@ -62,7 +62,7 @@ int ResizeBaseCPUKernel::CheckParameters() { MS_LOG(INFO) << "Out shape is not assigned"; const_shape_ = false; } else { - auto ret = CalculateNewHeightWidth(); + auto ret = CalculateLinearNewHeightWidth(); if (ret != RET_OK) { return ret; } @@ -78,7 +78,10 @@ int ResizeBaseCPUKernel::CheckParameters() { return RET_OK; } -int ResizeBaseCPUKernel::CalculateNewHeightWidth() { +int ResizeBaseCPUKernel::CalculateLinearNewHeightWidth() { + if (method_ != static_cast(schema::ResizeMethod_LINEAR)) { + return RET_OK; + } if (in_tensors_.size() != 2) { return RET_ERROR; } diff --git a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.h b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.h index 65ad100092b..27a6c03bb37 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/resize_base.h +++ b/mindspore/lite/src/runtime/kernel/arm/base/resize_base.h @@ -47,7 +47,7 @@ class ResizeBaseCPUKernel : public LiteKernel { private: int CheckParameters(); int CheckInputsOuputs(); - int CalculateNewHeightWidth(); + int CalculateLinearNewHeightWidth(); }; } // namespace mindspore::kernel diff --git a/mindspore/lite/src/tensor.cc b/mindspore/lite/src/tensor.cc index a51ca99f995..3abcb0968fd 100644 --- a/mindspore/lite/src/tensor.cc +++ b/mindspore/lite/src/tensor.cc @@ -282,8 +282,7 @@ int Tensor::set_root_tensor(Tensor *tensor) { return RET_OK; } if (this->root_tensor_ == nullptr) { - MS_LOG(ERROR) << "root tensor is nullptr"; - return RET_NULL_PTR; + return RET_OK; } this->shape_ = this->root_tensor_->shape_; this->format_ = this->root_tensor_->format_;