Skip to content

Commit 48596ef

Browse files
Merge #1795
1795: Simplify mse() to use `abs2()` r=ToucheSir a=staticfloat This simplifies the implementation of `mse()` a bit, as requested by `@DhairyaLGandhi` Co-authored-by: Elliot Saba <staticfloat@gmail.com>
2 parents 878b39c + 73cb905 commit 48596ef

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/losses/functions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ julia> Flux.mse(y_model, y_true)
4444
"""
4545
function mse(ŷ, y; agg = mean)
4646
_check_sizes(ŷ, y)
47-
error =.- y
48-
real(agg(error .* conj(error)))
47+
agg(abs2.(ŷ .- y))
4948
end
5049

5150
"""

0 commit comments

Comments
 (0)