forked from mindspore-Ecosystem/mindspore
!21550 [MSLITE] Fix bug of pad operator.
Merge pull request !21550 from wangshaocong/bugfix_master
This commit is contained in:
commit
f367d4c9d8
|
@ -27,7 +27,6 @@ using mindspore::schema::PrimitiveType_PadFusion;
|
|||
namespace mindspore::kernel {
|
||||
namespace {
|
||||
constexpr size_t kPadCommonInputSize = 2;
|
||||
constexpr size_t kPadMaxInputSize = 3;
|
||||
} // namespace
|
||||
int PadFp16CPUKernel::RunImpl(int task_id) {
|
||||
PadFp16(input_, output_, in_, out_, pad_param_->paddings_, task_id, op_parameter_->thread_num_);
|
||||
|
@ -102,9 +101,6 @@ int PadFp16CPUKernel::Run() {
|
|||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
if (in_tensors_.size() == kPadMaxInputSize) {
|
||||
pad_param_->constant_value_ = reinterpret_cast<float *>(in_tensors_.at(2)->data_c())[0];
|
||||
}
|
||||
if (pad_param_->constant_value_ - 0.0f < 1e-5) {
|
||||
memset(output_, 0, output_tensor->ElementsNum() * sizeof(float16_t));
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace mindspore::kernel {
|
|||
namespace {
|
||||
constexpr size_t kMirrorPadInputSize = 2;
|
||||
constexpr size_t kPadCommonInputSize = 2;
|
||||
constexpr size_t kPadMaxInputSize = 3;
|
||||
} // namespace
|
||||
int PadCPUKernel::Init() {
|
||||
CHECK_LESS_RETURN(in_tensors_.size(), 1);
|
||||
|
@ -397,9 +396,6 @@ int PadCPUKernel::Run() {
|
|||
return RET_ERROR;
|
||||
}
|
||||
}
|
||||
if (in_tensors_.size() == kPadMaxInputSize) {
|
||||
pad_param_->constant_value_ = reinterpret_cast<float *>(in_tensors_.at(2)->data_c())[0];
|
||||
}
|
||||
auto output = out_tensors_.at(0);
|
||||
int output_size = output->ElementsNum();
|
||||
auto output_data = reinterpret_cast<float *>(output->data_c());
|
||||
|
|
Loading…
Reference in New Issue