Browse Source

!13229 [MS][LITE][Develop]fix mirror padding float abortion

From: @lx0095
Reviewed-by: @zhang_xue_tong,@hangangqiang
Signed-off-by: @zhang_xue_tong
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
6057ac5cf4
3 changed files with 21 additions and 7 deletions
  1. +7
    -1
      mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc
  2. +9
    -5
      mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc
  3. +5
    -1
      mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc

+ 7
- 1
mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc View File

@@ -66,7 +66,13 @@ int PadFp16CPUKernel::Run() {
MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]";
}
} else {
HandleMirrorPad();
// mirror pad case
ret = HandleMirrorPad();
if (ret != RET_OK) {
MS_LOG(ERROR) << "Handle mirror pad failed, error_code[" << ret << "]";
return ret;
}

ret = ParallelLaunch(this->context_->thread_pool_, MirrorPadImpl, this, context_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Pad Reflect or Symmetric mode run error, error_code[" << ret << "]";


+ 9
- 5
mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc View File

@@ -299,12 +299,12 @@ int PadCPUKernel::CheckPaddings(int *paddings, int length, int *input_shape, int
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 less than " << max_valid + 1;
MS_LOG(WARNING) << "Running mirror pad with padding bigger than shape.";
}
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;
MS_LOG(WARNING) << "Running mirror pad with padding bigger than shape.";
}
}
return RET_OK;
@@ -402,7 +402,11 @@ int PadCPUKernel::Run() {
}
} else {
// mirror pad case
HandleMirrorPad();
error_code = HandleMirrorPad();
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Handle mirror pad failed, error_code[" << error_code << "]";
return error_code;
}

error_code = ParallelLaunch(this->context_->thread_pool_, MirrorPadImpl, this, context_->thread_num_);
if (error_code != RET_OK) {


+ 5
- 1
mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc View File

@@ -274,7 +274,11 @@ int PadInt8CPUKernel::Run() {
}
} else {
// mirror pad case
HandleMirrorPad();
error_code = HandleMirrorPad();
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Handle mirror pad failed, error_code[" << error_code << "]";
return error_code;
}

error_code = ParallelLaunch(this->context_->thread_pool_, MirrorPadImplInt8, this, context_->thread_num_);
if (error_code != RET_OK) {


Loading…
Cancel
Save