Open ikirill opened 3 years ago
I have a similar issue. This is my test case:
julia> ForwardDiff.derivative(x -> x * ForwardDiff.derivative(y -> x + y, 1), 1) # OK
1
julia> ReverseDiff.gradient(x -> x[1] * ReverseDiff.gradient(y -> x[1] + y[1], [1]), [1]) # OK
1-element Vector{Int64}:
1
julia> ReverseDiff.gradient(x -> x[1] * ForwardDiff.derivative(y -> x[1] + y, 1), [1]) # OK
1-element Vector{Int64}:
1
julia> ForwardDiff.derivative(x -> x * ReverseDiff.gradient(y -> x + y[1], [1]), 1) #BUG
1-element Vector{Int64}:
0
I'm not sure if this is even supported, but I think it should throw an error instead of returning zero gradients
The first example is an old bug (#45 ), the second shows you can't nest ReverseDiff inside ForwardDiff, the third shows you can the other way around.