ForwardDiff2.jl icon indicating copy to clipboard operation
ForwardDiff2.jl copied to clipboard

Incorrect gradient + dual leakage

Open MikeInnes opened this issue 5 years ago • 0 comments

Though this is a similar symptom to #31, it's a very different (and more interesting) case. Although FD2 can't force users not to leak duals in general, in this case it has every opportunity to deal with them as usual but simply doesn't.

julia> D(1) do x
         D(2) do y
           D(3) do z
             x = z * y
           end
         end
         x
       end
(2 + 1ϵ₂)

(correct answer is 0; ForwardDiff throws an ambiguous tag error which is the easy fix in this case too, assuming there's no interest in making the tag system more capable.)

MikeInnes avatar Jan 24 '20 10:01 MikeInnes