From b491055a70e3162eee15913e2886f0ba5812050f Mon Sep 17 00:00:00 2001 From: zhaozhenlong Date: Thu, 17 Sep 2020 10:40:46 +0800 Subject: [PATCH] use correct input shape to calculate strides --- mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc index a7fe0b3916..8349c0f0ea 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc @@ -201,10 +201,9 @@ int PadCPUKernel::CopyPaddingFromInput() { } void PadCPUKernel::CalculateStrides() { - auto input_shape = in_tensors_.at(0)->shape(); pad_param_->in_strides[DEFAULT_PAD_NDIMS - 1] = 1; for (auto i = DEFAULT_PAD_NDIMS - 2; i >= 0; --i) { - pad_param_->in_strides[i] = input_shape[i + 1] * pad_param_->in_strides[i + 1]; + pad_param_->in_strides[i] = in_[i + 1] * pad_param_->in_strides[i + 1]; } for (auto i = 0; i < DEFAULT_PAD_NDIMS; ++i) { out_[i] = in_[i] + pad_param_->paddings_[i * 2] + pad_param_->paddings_[i * 2 + 1];