JuliaDiff / ReverseDiff.jl

Reverse Mode Automatic Differentiation for Julia
Other
348 stars 57 forks source link

Perturbation Confusion (Nested Differentiation Bug) #45

Open jrevels opened 7 years ago

jrevels commented 7 years ago

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

MikeInnes commented 6 years ago

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

yangky11 commented 3 years ago

Hi,

Any luck in fixing this bug?