ReverseDiff.jl
ReverseDiff.jl copied to clipboard
Perturbation Confusion (Nested Differentiation Bug)
I already mention this in ReverseDiff's documentation, but I'm opening this issue to increase visibility and track progress.
ReverseDiff has the same perturbation confusion issue as ForwardDiff. My plan to solve this in ReverseDiff is the same as my plan to solve this in ForwardDiff; the tag will be added to the TrackedArray
/TrackedReal
types (and possibly the tape types, I'm not sure yet).
Here's a simple test case, if anyone is interested:
D(f, x) = ReverseDiff.gradient(x->f(x[1]), [x])[1]
D(x -> x * D(y -> x * y, 3), 5) # 3
D(x -> x * D(y -> y * x, 3), 5) # 5
(the correct answer is 2x, or 10).
Hi,
Any luck in fixing this bug?