!12050 [MS][LITE] fix prelu memcpy bug

From: @jianghui58
Reviewed-by: @zhanghaibo5,@HilbertDavid
Signed-off-by: @zhanghaibo5
This commit is contained in:
mindspore-ci-bot 2021-02-04 09:42:11 +08:00 committed by Gitee
commit d66d5fcedd
1 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ int PReluCPUKernel::ProcessInput() {
MS_LOG(ERROR) << "malloc input_data_ failed.";
return RET_ERROR;
}
memcpy(input_data_, ori_input_, tile_block * TILE_NUM * channel_num * sizeof(float));
memcpy(input_data_, ori_input_, prelu_param_->input_num_ * sizeof(float));
return RET_OK;
}
@ -85,7 +85,7 @@ int PReluCPUKernel::ProcessShareChannelInput() {
MS_LOG(ERROR) << "malloc input_data_ failed.";
return RET_ERROR;
}
memcpy(input_data_, ori_input_, prelu_param_->tile_block_ * 64 * sizeof(float));
memcpy(input_data_, ori_input_, prelu_param_->input_num_ * sizeof(float));
#elif ENABLE_ARM32
prelu_param_->tile_block_ = UP_DIV(prelu_param_->input_num_, 32);
input_data_ = reinterpret_cast<float *>(context_->allocator->Malloc(prelu_param_->tile_block_ * 32 * sizeof(float)));
@ -93,7 +93,7 @@ int PReluCPUKernel::ProcessShareChannelInput() {
MS_LOG(ERROR) << "malloc input_data_ failed.";
return RET_ERROR;
}
memcpy(input_data_, ori_input_, prelu_param_->tile_block_ * 32 * sizeof(float));
memcpy(input_data_, ori_input_, prelu_param_->input_num_ * sizeof(float));
#else
prelu_param_->tile_block_ = UP_DIV(prelu_param_->input_num_, 32);
input_data_ = reinterpret_cast<float *>(context_->allocator->Malloc(prelu_param_->tile_block_ * 32 * sizeof(float)));
@ -101,7 +101,7 @@ int PReluCPUKernel::ProcessShareChannelInput() {
MS_LOG(ERROR) << "malloc input_data_ failed.";
return RET_ERROR;
}
memcpy(input_data_, ori_input_, prelu_param_->tile_block_ * 32 * sizeof(float));
memcpy(input_data_, ori_input_, prelu_param_->input_num_ * sizeof(float));
#endif
return RET_OK;
}