Browse Source

use correct input shape to calculate strides

tags/v1.0.0
zhaozhenlong 5 years ago
parent
commit
b491055a70
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc

+ 1
- 2
mindspore/lite/src/runtime/kernel/arm/fp32/pad.cc View File

@@ -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];


Loading…
Cancel
Save