-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect jacobian with Zygote + ReverseDiffAdjoint #238
Comments
Run it at low tolerances? |
Using e.g. |
The problem seems to be julia> sensitivity();
isapprox(J1, J2; rtol = 0.001) = true
isapprox(J1, J3; rtol = 0.001) = true
isapprox(J2, J3; rtol = 0.001) = true
J1[4, 1] = 0.011848062676608925
J2[4, 1] = 0.011848062676608925
J3[4, 1] = 0.011848057817131118 |
This will fallback to ForwardDiffSensitivity, which isn't exactly the same as ForwardDiff on the solver but is fairly close. So yeah it sounds like ReverseDiff is losing something somewhere, maybe due to aliasing. |
The following example shows that - similar to the example in the tests - ForwardDiff and finite differencing (here FiniteDifferences, in the tests FiniteDiff) produces similar gradients and Jacobians. However, the Jacobian computed by Zygote differs quite significantly:
Output:
The text was updated successfully, but these errors were encountered: