!6877 [MSLITE] Fix bug of resizeNearestNeighbor operator.

Merge pull request !6877 from wangshaocong/bugfix_master
This commit is contained in:
mindspore-ci-bot 2020-09-27 09:32:01 +08:00 committed by Gitee
commit 8a28b4114f
3 changed files with 13 additions and 10 deletions

View File

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

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;

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