Skip to content

Commit f2998cf

Browse files
authored
Simplify mse() to use abs2()
This simplifies the implementation of `mse()` a bit.
1 parent 8fa4317 commit f2998cf

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)