-
Notifications
You must be signed in to change notification settings - Fork 5
[AD] add chainrules support for svd_vals and eig(h)_vals and add diagonal
#107
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
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
|
LGTM although why not add these special pullbacks (which are not needed for Enzyme or Mooncake) to the chain rules extension? |
|
I think we might have to specialize the |
|
Ok this went fast. I still have to study the PR in a bit more detail. Was it worth adding the With |
|
Oh I also only now see that you did actually discuss this above 😄 |
|
Apologies for the fast merge, I thought this was a pretty small change somehow. |
|
No problem. Yes I agree such a hook is useful, and since the pullback cannot be computed without knowing |
Here I write chainrules for the different
f_valsfunctions.To make these implementations sufficiently generic, I added
f_vals_pullbackfunctions that may be overloaded, but usually don't have to be since they simply fall back tof_pullbackwith the correct zerotangents filled in.A small hiccup here is that in order to do this, I effectively require the inverse operation of
diagview, which I introduced here asdiagonal. I didn't want to simply useDiagonal, since that has the restriction that it has to return aDiagonaltype, and MatrixAlgebraKit feels like the correct place to introduce such a function.Finally, I also updated the mooncake rules to make use of the updated pullback functions. As I'm still getting the hang of that, it might be nice to double-check that I did that correctly.
This PR fixes #88.