forked from mindspore-Ecosystem/mindspore
!47692 BCEGrad bugfix for loss calculation when reduction is Mean
Merge pull request !47692 from zhangyanhui/code_mas
This commit is contained in:
commit
560e83bad0
mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32_grad
|
@ -37,7 +37,7 @@ int BinaryCrossEntropyGrad(const int input_size, const int reduction, const floa
|
|||
}
|
||||
} else {
|
||||
float dloss1 = dloss[0];
|
||||
if (reduction == Reduction_Sum) {
|
||||
if (reduction == Reduction_Mean) {
|
||||
dloss1 = dloss[0] / input_size;
|
||||
}
|
||||
for (int i = 0; i < input_size; i++) {
|
||||
|
|
Loading…
Reference in New Issue