patrick-kidger / patrick-kidger/diffrax
Possible to get BacksolveAdjoint backward pass solution/stats?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
Thanks for this excellent library!
When using BacksolveAdjoint adjoint method, it's easy to get (and log) forward pass stats with
sol = diffrax.diffeqsolve(
terms, solver, t_0, t_T, initial_step_size, init_y, args,
saveat=saveat, stepsize_controller=stepsize_controller,
adjoint=diffrax.BacksolveAdjoint()
)
stats = sol.stats
# ...
(loss, stats), grads = jax.value_and_grad(loss_fn, has_aux=True)(policy_params, init_states)
I believe the backward pass also involves solving ODE, but I did not figure out a way to get its stats. Could you suggest how to achieve this functionality? Or is it something limited by JAX API?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the diffrax.diffeqsolve entry point and BacksolveAdjoint, then trace how forward-pass sol.stats is exposed through the shown jax.value_and_grad call. Determine whether backward-solve statistics can be surfaced through this API; done means a supported retrieval path is documented or the JAX limitation is clearly explained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100