Skip to content

Commit

Permalink
Remove abs rules now in ChainRules
Browse files Browse the repository at this point in the history
  • Loading branch information
sethaxen committed Jun 30, 2020
1 parent b4d1529 commit 59cd2df
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/lib/number.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@ end
@adjoint conj(x::Number) = conj(x), r̄ -> (conj(r̄),)
@adjoint imag(x::Number) = imag(x), ī -> (real(ī)*im,)

# we intentionally define these here rather than falling back on ChainRules.jl
# because ChainRules doesn't really handle nonanalytic complex functions
@adjoint abs(x::Real) = abs(x), Δ -> (real(Δ)*sign(x),)
@adjoint abs(x::Complex) = abs(x), Δ -> (real(Δ)*x/abs(x),)
@adjoint abs2(x::Number) = abs2(x), Δ -> (real(Δ)*(x + x),)

0 comments on commit 59cd2df

Please sign in to comment.