Skip to content

torchdde

torchdde is a library that provides numerical solvers in Pytorch for Delay Differential Equations (DDEs) with constant delays.

Warning

This a brand new library, please reach out for feedback, issues !

Installation¤

pip install torchdde

or locally

git clone https://github.com/thibmonsel/torchdde.git
pip install torchdde/

Quick example¤

import torch
from torchdde import integrate, RK2

def f(t, y, args, history):
    return y * (1 - history[0])

solver = RK2()
delays = torch.tensor([1.0])
history_values = torch.arange(1, 5).reshape(-1, 1)
history_function = lambda t: history_values
solution = integrate(f, solver, ts[0], ts[-1], ts, y0, None, dt0=ts[1]-ts[0], delays=delays)