Skip to content
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

Is adjoint method implemented for Adams and other adaptive time-stepping solvers? #1

Closed
ibulu opened this issue Aug 7, 2020 · 4 comments

Comments

@ibulu
Copy link

ibulu commented Aug 7, 2020

Really great work! I am wondering whether adjoint method is implemented for adaptive-stepping solvers such as Adams and others in your repo.

@jacobjinkelly
Copy link
Owner

Thanks! Currently the adjoint method is only implemented for dopri5 adaptive and rk4 fixed-grid here. We found these solvers to be the fastest in wall-clock time, so these were the only solvers we used during training (hence the only ones we implemented a backward pass for via the adjoint method).

The adjoint method hooks into JAX's AD via defvjp (you can have a look at the JAX docs and code for custom_vjp, defvjp). I would recommend looking at how the adjoint is defined for _dopri5_odeint using _odeint_fwd and _odeint_rev as an example to go off of. The only change you need to make to define the adjoint for different solvers is to defvjp using a fwd and bwd function which calls the appropriate solver. In fact, you can use different solvers for the forward and backward pass if you wanted to!

Let me know if that makes sense, or anything else I can help with.

@ibulu
Copy link
Author

ibulu commented Aug 7, 2020

sounds good. I just tried the odeint_grid function. it is returning a solution only at two time points regardless of t.

@jacobjinkelly
Copy link
Owner

Yes, unfortunately it's a bit trickier to create a grid for multiple time points. An implementation is in torchdiffeq but I wasn't able to port it to JAX.

@ibulu
Copy link
Author

ibulu commented Aug 7, 2020

ohh no worries. I should have read the source code mode carefuly

@ibulu ibulu closed this as completed Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants