!39191 [MS][LITE] fix bias grad bug

Merge pull request !39191 from jianghui58/micro_train_dev
This commit is contained in:
i-robot 2022-07-30 07:22:26 +00:00 committed by Gitee
commit 17675daf15
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 2 deletions

View File

@ -67,10 +67,11 @@ int BiasGradCPUKernel::DoExecute(int task_id) {
size_t total_size = channels * nhw_size;
for (size_t c = 0; c < channels; ++c) {
out[c] = 0;
float tmp = 0.0f;
for (size_t offset = 0; offset < total_size; offset += channels) {
out[c] += in[offset + c];
tmp += in[offset + c];
}
out[c] = tmp;
}
return RET_OK;