-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add support for Jacobians #22
Conversation
…view `dx` that doesn't match the type of `x`
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
==========================================
+ Coverage 85.98% 88.82% +2.84%
==========================================
Files 9 11 +2
Lines 107 170 +63
==========================================
+ Hits 92 151 +59
- Misses 15 19 +4 ☔ View full report in Codecov by Sentry. |
Good news: only Enzyme required specialized In both cases, this was due to Enzyme's One annoyance encountered in this PR is that |
Superseded by #23. |
This PR adds fallback implementatios for
value_and_jacobian!
,value_and_jacobian
,jacobian!
, andjacobian
.The implementation dispatches on
AbstractForwardBackend
andAbstractReverseBackend
:AbstractForwardBackend
: Makes use ofvalue_and_pushforward!
, which computes JVPs. The pushforward of a standard basis vectorAbstractReverseBackend
: Makes use ofvalue_and_pullback!
, which compute VJPs. The pullback of a standard basis vectorThis requires the implementation of a standard basis vector in
src/unitvector
.This implementation can be replaced with more performant implementations in the future by specializing on backend types.
To write into pre-allocated Jacobians, type annotations of pullbacks and pushforwards had to be loosened.
Towards #6.