Skip to content

Commit

Permalink
Merge #1795
Browse files Browse the repository at this point in the history
1795: Simplify mse() to use `abs2()` r=DhairyaLGandhi a=staticfloat

This simplifies the implementation of `mse()` a bit, as requested by `@DhairyaLGandhi` 

Co-authored-by: Elliot Saba <[email protected]>
  • Loading branch information
bors[bot] and staticfloat authored Dec 1, 2021
2 parents 8fa4317 + f2998cf commit 638fb1f
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 638fb1f

Please sign in to comment.