Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on:
push:
branches:
- master # Set this to your default branch

on: push

jobs:
build:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Python Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ delays = torch.tensor([1.0, 2.0])
history_function = lambda t : ...
ts = ...

def simple_dde(t, y, args, *, history):
def simple_dde(t, y, func_args, *, history):
# this correspond to y'(t) = -y(t-1) - y(t-2)
return - history[0] - history[1]

ys = torchdde.integrate(f, solver, ts[0], ts[-1], ts, history_function, args=None, dt0=ts[1]-ts[0], delays=delays)
ys = torchdde.integrate(f, solver, ts[0], ts[-1], ts, history_function, func_args=None, dt0=ts[1]-ts[0], delays=delays)
```

## How about if I want a neural network to have also several delays ?
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import matplotlib.pyplot as plt
from torchdde import RK4
import torch

def simple_dde(t, y, args, *, history):
def simple_dde(t, y, func_args, *, history):
# `history` corresponds to the list of
# delayed states defined in your DDE
# i.e. here history=[y(t-2)]
Expand Down Expand Up @@ -54,7 +54,7 @@ import matplotlib.pyplot as plt
from torchdde import RK4
import torch

def simple_ode(t, y, args):
def simple_ode(t, y, func_args):
return -y**2

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/integration-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ What essentially differentiates DDEs with ODEs are :

In practice, your function will be defined like this :
```python
def f_ode(t,y,args):
def f_ode(t,y,func_args):
return ...

def f_dde(t,y,args, history):
def f_dde(t,y,func_args, history):
return ...
```

Expand Down
8 changes: 4 additions & 4 deletions docs/usage/neural-dde.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NDDE(nn.Module):
hidden_channels=depth * [width_size] + [out_size],
)

def forward(self, t, z, args, *, history):
def forward(self, t, z, func_args, *, history):
# `history` corresponds to the list of
# delayed states defined in your DDE
# i.e. here history=[y(t-tau1), ..., y(t-taun)]
Expand All @@ -54,11 +54,11 @@ We generate the toy dataset of the [delayed logistic equation](https://www.math.

```python
def get_data(y0, ts, tau=torch.tensor([1.0])):
def f(t, y, args, history):
def f(t, y, func_args, history):
return y * (1 - history[0])

history_function = lambda t: torch.unsqueeze(y0, dim=1)
ys = integrate(f, Euler(), ts[0], ts[-1], ts, history_function, args=None, dt0=ts[1]-ts[0], delays=tau)
ys = integrate(f, Euler(), ts[0], ts[-1], ts, history_function, func_args=None, dt0=ts[1]-ts[0], delays=tau)
return ys


Expand Down Expand Up @@ -136,7 +136,7 @@ def main(
plt.plot(ts.cpu(), data[0].cpu(), c="dodgerblue", label="Real")
history_values = data[0, 0][..., None]
history_fn = lambda t: history_values
ys_pred = integrate(model, Euler(), ts[0], ts[-1], ts, history_fn, args=None, dt0=ts[1]-ts[0], delays=tau)
ys_pred = integrate(model, Euler(), ts[0], ts[-1], ts, history_fn, func_args=None, dt0=ts[1]-ts[0], delays=tau)
plt.plot(
ts.cpu(),
ys_pred[0].cpu().detach(),
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/training-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for step, data in enumerate(train_loader):
t1=ts[-1],
ts=ts,
y0=...,
args=None,
func_args=...,
dt0=ts[1] - ts[0],
delays=...,
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "torchdde"
version = "0.1.2"
version = "0.2.0"
description = "DDE numerical solvers in Python."
readme = "README.md"
requires-python =">=3.9"
Expand Down
1 change: 1 addition & 0 deletions torchdde/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
FourthOrderPolynomialInterpolation as FourthOrderPolynomialInterpolation,
ThirdOrderPolynomialInterpolation as ThirdOrderPolynomialInterpolation,
)
from .misc import TupleTensorTransformer as TupleTensorTransformer
from .solver import (
AbstractOdeSolver as AbstractOdeSolver,
Bosh3 as Bosh3,
Expand Down
Loading