rtqichen / torchdiffeq

Differentiable ODE solvers with full GPU support and O(1)-memory backpropagation.
MIT License
5.61k stars 930 forks source link

Perform one integration step #248

Open JackCaster opened 8 months ago

JackCaster commented 8 months ago

I am looking forward to using some of the solvers in this repo. Thank you for your work!

I am porting a code from Scipy to Pytorch. I have an ODE with time-varying coefficients so I cannot solve the equation in one go, but I'd need to perform a step-by-step integration. In Scipy, I am using the RK45's step method. Is there something equivalent in torchdiffeq I could use?

rtqichen commented 8 months ago

The current API isn't designed with this mind unfortunately. The only way to implement it is to use the internal functions. The equivalent to the step method is the _advance method: https://github.com/rtqichen/torchdiffeq/blob/master/torchdiffeq/_impl/solvers.py#L34.

JincanDeng commented 6 months ago

The current API isn't designed with this mind unfortunately. The only way to implement it is to use the internal functions. The equivalent to the step method is the _advance method: https://github.com/rtqichen/torchdiffeq/blob/master/torchdiffeq/_impl/solvers.py#L34.

It seems that the _advance method has not been implemented.