patrick-kidger / patrick-kidger/diffrax
Intermediate saved values are sometimes `inf`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
Hi Patrick! I've run into an issue over in https://github.com/dynamiqs/dynamiqs/issues/666 when t0=t1 and I try to save intermediate values. It seems to be independent of the stepsize_controller that I use (adaptive or constant). Here is a minimal example using constant steps.
import diffrax as dx
import jax.numpy as jnp
term = dx.ODETerm(lambda t, y, _: y)
y0 = jnp.array([1.0])
ts = jnp.array([0.0, 0.0])
saveat = dx.SaveAt(subs=[dx.SubSaveAt(ts=ts), dx.SubSaveAt(t1=True)])
solution = dx.diffeqsolve(
term,
dx.Tsit5(),
ts[0],
ts[-1],
0.1,
y0,
saveat=saveat,
)
print(solution.ys[0]) # [[inf] [inf]]
print(solution.ys[1]) # [[1.]]
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
Reproduce the minimal example with diffrax.diffeqsolve, SaveAt, and SubSaveAt when t0 equals t1. Inspect the intermediate-value saving path and compare it with the final-value path; done means the requested intermediate values are finite and match the expected values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100