You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code used to work in ReverseDiff 1.2.0 but the current version (1.4.2) returns the wrong derivatives. I've stripped away everything to a MWE:
import ForwardDiff
import ReverseDiff
struct Test{TF}
a::TFendfunctionfunc(x)
tvec =Test.(x[1:2])
a = [t.a for t in tvec]
returnsum([a; x[3]])
end
x = [1.0, 2.0, 3.0]
J1 = ForwardDiff.gradient(func, x)
J2 = ReverseDiff.gradient(func, x)
The answer should be [1, 1, 1], but ReverseDiff gives [0, 0, 1]. If I revert back to 1.2 then it works as expected. Trying different versions it seems that from 1.3 onward this no longer works.
Activity
mohdibntarek commentedon Sep 21, 2020
I think I know what's happening here. I will work on a fix soon.
Support arrays with non-concrete eltype (fixes #264)
devmotion commentedon Sep 18, 2026
Fixed by #169. #300 will add a regression test.
Support arrays with non-concrete eltype (fixes #264) (#300)