Skip to content

Commit

Permalink
Simplify mse() to use abs2()
Browse files Browse the repository at this point in the history
This simplifies the implementation of `mse()` a bit.
  • Loading branch information
staticfloat authored Dec 1, 2021
1 parent 8fa4317 commit f2998cf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/losses/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ julia> Flux.mse(y_model, y_true)
"""
function mse(ŷ, y; agg = mean)
_check_sizes(ŷ, y)
error =.- y
real(agg(error .* conj(error)))
agg(abs2.(ŷ .- y)))
end

"""
Expand Down

0 comments on commit f2998cf

Please sign in to comment.