From 3a1647a808222e50c69e180d11619dc0beb5c051 Mon Sep 17 00:00:00 2001 From: jianghui58 Date: Wed, 3 Feb 2021 16:25:01 +0800 Subject: [PATCH] fix prelu memcpy bug --- mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc index 35d9ebb1c1a..9733979f406 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc @@ -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(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(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; }