Browse Source

Fix bug of resize operator.

tags/v1.1.0
wang_shaocong 5 years ago
parent
commit
672a5b912e
3 changed files with 13 additions and 10 deletions
  1. +9
    -3
      mindspore/lite/src/ops/depthwise_conv2d.cc
  2. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc
  3. +3
    -6
      mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc

+ 9
- 3
mindspore/lite/src/ops/depthwise_conv2d.cc View File

@@ -92,9 +92,15 @@ int DepthwiseConv2D::UnPackAttr(const Primitive &prim, const std::vector<AnfNode
attr->dilateH = dilation[0];
attr->dilateW = dilation[1];

auto kernel_size = GetValue<std::vector<int>>(prim.GetAttr("kernel_size"));
attr->kernelH = kernel_size[0];
attr->kernelW = kernel_size[1];
if (utils::isa<ValueSequeue>(prim.GetAttr("kernel_size"))) {
auto kernel_size = GetValue<std::vector<int>>(prim.GetAttr("kernel_size"));
attr->kernelH = kernel_size[0];
attr->kernelW = kernel_size[1];
} else {
auto kernel_size = GetValue<int>(prim.GetAttr("kernel_size"));
attr->kernelH = kernel_size;
attr->kernelW = kernel_size;
}

auto stride = GetValue<std::vector<int>>(prim.GetAttr("stride"));
attr->strideH = stride[2];


+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/base/resize_base.cc View File

@@ -58,7 +58,7 @@ int ResizeBaseCPUKernel::CheckParameters() {
return RET_INVALID_OP_ATTR;
}
} else if (this->in_tensors_.size() == lite::kDoubleNum) {
auto out_shape = this->in_tensors_[1]->MutableData();
auto out_shape = this->in_tensors_[1]->data_c();
if (out_shape == nullptr) {
MS_LOG(INFO) << "Out shape is not assigned";
const_shape_ = false;


+ 3
- 6
mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc View File

@@ -23,8 +23,8 @@

using mindspore::lite::RET_ERROR;
using mindspore::lite::RET_MEMORY_FAILED;
using mindspore::lite::RET_OK;
using mindspore::lite::RET_NULL_PTR;
using mindspore::lite::RET_OK;

namespace mindspore::kernel {

@@ -213,12 +213,10 @@ int PadInt8CPUKernel::CheckPaddings(int *paddings, int length, int *input_shape,
for (auto i = 0; i < length; ++i) {
int max_valid = input_shape[i] - offset;
if (paddings[i * 2] > max_valid) {
MS_LOG(ERROR) << prefix << "paddings " << paddings[i * 2] << "should be less than " << max_valid + 1;
return RET_ERROR;
MS_LOG(WARNING) << prefix << "paddings " << paddings[i * 2] << "should be more than " << max_valid + 1;
}
if (paddings[i * 2 + 1] > max_valid) {
MS_LOG(ERROR) << prefix << "paddings " << paddings[i * 2 + 1] << "should be less than " << max_valid + 1;
return RET_ERROR;
MS_LOG(WARNING) << prefix << "paddings " << paddings[i * 2 + 1] << "should be less than " << max_valid + 1;
}
}
return RET_OK;
@@ -278,7 +276,6 @@ int PadInt8CPUKernel::Run() {
}
}


return RET_OK;
}
} // namespace mindspore::kernel

Loading…
Cancel
Save