-
-
Notifications
You must be signed in to change notification settings - Fork 30
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 ChainRules rules #40
Comments
There should be ways to do this without defining the Jacobian. du = Au -> dlambda -> lambda'*A which means the adjoint should just be expv(A,delta'). |
For |
Especially since |
Yeah, the difficult thing will be supporting something that's not concrete, since then it can't adjoint. But then that's just defined as the reverse mode of the function Those again would come from this derivation. You might want to read https://diffeq.sciml.ai/stable/extras/sensitivity_math/ or the supplemental of https://arxiv.org/abs/2001.04385 . Specifically, the ∂t is easy in this interpretation: λ = expv(t, A, u) = exp(t*A)*u is equal to λ=Aλ where λ(0)=u and solve to Again, all might be missing a detail since I'm doing it quickly, but that should be the gist of it. |
Thanks! That should be enough to get me started. I'll probably tackle this in a few months if no one else does before then (unless I find some time early). |
Working on this now and have some follow-up questions.
I've spent some time working through the provided references and still haven't yet comprehended this comment. What is |
Hmm, I guess it doesn't use the phi_1. It is the first integral of the term so I'm a little surprised it doesn't show up. |
Okay, I think I worked something out for forward mode at least. The pushforward of |
Following up on @ChrisRackauckas's point, we can indeed compute the adjoint of I haven't worked out how to solve this ODE using just the functions in this package; currently I require OrdinaryDiffEq. This does what I need to right now, so I'll put #51 on hold until I work out something efficient I can do using just this package. |
Another way to compute the adjoint of |
Here's where I landed on this. The adjoint for For matrix We need a function like |
(Note that this block-triangular rule is a special case of an algorithm to differentiate matrix functions by Mathias in 1996, as discussed in JuliaDiff/ChainRules.jl#764) |
From Slack:
@sethaxen:
@ChrisRackauckas:
I in particular need adjoints for
expv
. Zygote currently has an adjoint rule forexp(::AbstractMatrix)
andexp(::Hermitian)
using the eigendecomposition. I imagine though there's a better way to implement the adjoints forexpv
by looking at the underlying algorithm (I have not).The text was updated successfully, but these errors were encountered: