ForwardDiff.jl
ForwardDiff.jl copied to clipboard
Perturbation Confusion issue
D(f, x) = ForwardDiff.derivative(f, x)
D(1) do x
f(y) = (x = x*y)
D(f, 1)
D(f, 1)
end # => 2
The correct answer is 1. This is essentially the same as https://github.com/YingboMa/ForwardDiff2.jl/issues/37.