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

Perturbation Confusion (Nested Differentiation Bug)

Open jrevels opened this issue 7 years ago • 2 comments

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).

jrevels avatar Jan 13 '17 20:01 jrevels

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).

MikeInnes avatar Jun 28 '18 16:06 MikeInnes

Hi,

Any luck in fixing this bug?

yangky11 avatar Apr 27 '21 13:04 yangky11