rtqichen / torchdiffeq

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

Non uniform time step in example/ode_demo.py #242

Open zhengqigao opened 1 year ago

zhengqigao commented 1 year ago

Hi,

Thanks for the great work and repo. I am reading the ode_demo.py under the example folder. At present, the time steps are defined by t = torch.linspace(0., 25., args.data_size).to(device) which is uniform. Thus in line 166, we could pass batch_t which is a tensor of shape (10,) to the odeint function. One advantage of using Neural ODE to time series data should be its capability to handle non-uniform time steps. I wonder if the data is provided associated with non-uniform time steps (i.e., t is non-uniform), how should we modify the script to make it applicable? Specifically, I would like to know how to revise line 166. Should we provide a tensor batch_t of shape (10,20) now?