Skip to main content

yabi-torch

A batched, differentiable ODE solver for PyTorch — YABI's variable-order BDF integrator with the continuous adjoint, wrapped as a torch-native solve_ivp.

pip install yabi-torch
import torch
from yabi_torch import solve_ivp

# Robertson — a classic stiff ODE (mass-conserving chemical kinetics)
def f(y):
    return torch.stack([
        -0.04 * y[0] + 1e4 * y[1] * y[2],
         0.04 * y[0] - 1e4 * y[1] * y[2] - 3e7 * y[1] ** 2,
         3e7 * y[1] ** 2,
    ])

y0 = torch.tensor([1.0, 0.0, 0.0], dtype=torch.float64, requires_grad=True)
yT = solve_ivp(f, y0, t_span=(0.0, 1e5), rtol=1e-6, atol=1e-10)

yT.sum().backward()          # y0.grad = d(sum y(T)) / d y0, via the continuous adjoint
print(yT)                    # [0.0179, 7.3e-8, 0.9821]  (mass conserved)

What it is

yabi_torch.solve_ivp solves the autonomous initial-value problem y' = f(y), y(t0) = y0 with YABI's BDF integrator (orders 1–6, variable step, Newton iteration) — the kind of solver that handles stiff systems where explicit methods like torchdiffeq's RK need impractically small steps. It is differentiable in y0 and in the model parameters θ through the continuous adjoint, so a neural ODE can be trained (loss.backward() fills both y0.grad and the network's .grad).

  • f is a torch.nn.Module or any callable y -> f(y) on a float64 tensor — no hand-written Jacobian (it is computed automatically with torch.autograd).
  • y0 may be a single (n,) or a batch (batch, n); the gradient is the adjoint per trajectory.

API

solve_ivp(f, y0, t_span=(0.0, 1.0), rtol=1e-8, atol=1e-10,
          jac=None, solver="dense", threads=1, device="cpu")
option meaning
f the vector field y -> f(y) (torch.nn.Module or callable)
y0 (n,) or (batch, n) torch.float64 tensor
t_span (t0, t1) — f is autonomous, so only t1 - t0 matters
jac optional analytic Jacobian, numpy (n,) -> (n*n,) column-major (else automatic)
solver "dense" (full Jacobian, dense Newton) or "matrix_free" (J·v via torch.autograd, GMRES)
threads trajectories solved concurrently (default 1 = serial; bit-identical to serial)
device "cpu" (default) or "cuda" (f/Jacobian on GPU + cuSOLVER Newton)

Features

  • Stiff-capable — BDF + Newton, not an explicit RK.
  • Automatic Jacobian — torch.autograd; pass jac only if you want the analytic path.
  • Dense and matrix-free — both Jacobian representations behind one API.
  • Batched + differentiable — solve a batch and backprop through it.
  • Parallel batch — threads=N is bit-identical to serial.
  • GPU — device="cuda" offloads the Newton LU to cuSOLVER; on a GPU with compute capability ≥ 7.5 it also evaluates f on-device.

Requirements

  • Python ≥ 3.10, NumPy, PyTorch ≥ 2.0.
  • Installing from source (the sdist) needs a C++17 compiler, CMake ≥ 3.16, and BLAS/LAPACK.

License

Apache-2.0. The integrator core is YABI.

Metadata

Release files for yabi-torch 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yabi-torch 0.1.3
File Size Uploaded Provenance Actions
yabi_torch-0.1.3.tar.gz 49.1 MB Without provenance Details for yabi_torch-0.1.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for yabi-torch 0.1.3
File Actions
yabi_torch-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for yabi_torch-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for yabi_torch-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for yabi_torch-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for yabi_torch-0.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 98.2 MB

Release files / yabi_torch-0.1.3.tar.gz

Download URL yabi_torch-0.1.3.tar.gz
Size 49.1 MB
Tags Source
SHA-256 checksum
How to use checksums
218357b853550d57707e18fd2e7cae57d00c26da37271e371800e1df4b4ccf4f
BLAKE2b-256 checksum
How to use checksums
56019289ea5c8b6ff9f7c63bc77a7024d36b09caa029cd6d1cf110eb46e7e39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / yabi_torch-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.3 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
7b34a65d73af657640f7f33a84799dc4ba2383b40308e32a8aad5be809169030
BLAKE2b-256 checksum
How to use checksums
341e522fd345a846dd50a5c73e108f0710308f9ba7625d575a4597e2c8bb7819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / yabi_torch-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.3 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
af6afb67b719504c2586d85f5b2432234c3fb74c8d0eb118d11b14d03d1b081d
BLAKE2b-256 checksum
How to use checksums
b440a0da9ed7f22058642a04aa24fe83113b63ec5cad801d940d3fe88fb51c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / yabi_torch-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.3 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
821d34a039d498421f750f4b26f0dab6b710414e16fba657d5cc6102bf889ce2
BLAKE2b-256 checksum
How to use checksums
869786c6e02cccb960c1d592ece25a051b755819a7a18c6cf6192f3238fb1957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / yabi_torch-0.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.3 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b25740b47336f1b1d2a82f7e071600e69ccebf50decef20101022acfe0746ae4
BLAKE2b-256 checksum
How to use checksums
7676f59fd1fe124218058850a516f939ec72f08b7ff3f12f4e9d21d3fed17a7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for yabi-torch 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page