Skip to content

Commit

Permalink
forwarddiff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Mar 29, 2019
1 parent ac49b15 commit 7d930ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/real.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ end
@adjoint a // b = (a // b, c̄ -> (c̄ * 1//b, -* a // b // b))

@nograd floor, ceil, trunc, round, hash

# Hack for conversions

using ForwardDiff: Dual

(T::Type{<:Real})(x::Dual) = Dual(T(x.value), map(T, x.partials.values))
(Dual{T,V,N})(x::Dual) where {T,V,N} = invoke(Dual{T,V,N}, Tuple{Number}, x)

0 comments on commit 7d930ab

Please sign in to comment.