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
|
@ -37,7 +37,7 @@ int BinaryCrossEntropyGrad(const int input_size, const int reduction, const floa
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float dloss1 = dloss[0];
|
float dloss1 = dloss[0];
|
||||||
if (reduction == Reduction_Sum) {
|
if (reduction == Reduction_Mean) {
|
||||||
dloss1 = dloss[0] / input_size;
|
dloss1 = dloss[0] / input_size;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < input_size; i++) {
|
for (int i = 0; i < input_size; i++) {
|
||||||
|
|
Loading…
Reference in New Issue