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 through the continuous adjoint, so gradients flow through the ODE solve.

  • 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.2

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.2
File Size Uploaded Provenance Actions
yabi_torch-0.1.2.tar.gz 49.1 MB Without provenance Details for yabi_torch-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for yabi-torch 0.1.2
File Actions
yabi_torch-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for yabi_torch-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.2-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.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for yabi_torch-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
yabi_torch-0.1.2-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.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 98.1 MB

Release files / yabi_torch-0.1.2.tar.gz

Download URL yabi_torch-0.1.2.tar.gz
Size 49.1 MB
Tags Source
SHA-256 checksum
How to use checksums
bba8ed4f74b62d98e9981c6ab0e867c875194ec358a2498613ba55e21ed16e4c
BLAKE2b-256 checksum
How to use checksums
e6f4de3d72b22e48df38a8d54080ec9b6ec7ab5f3dbd1b814fb2b9d553fd66ca
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.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.2-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
74c8e998d71b648359ab8105a77332bcc3240259d3efb9503582ac0a52ff1701
BLAKE2b-256 checksum
How to use checksums
52c6ac122d0d92ed7c361ce09d1f818d807f904ef2e967cb61822be99d2244f3
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.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.2-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
79d07c156af1cbe4e4366a25223f444df686256b22d4abd938bff0b9764ceb95
BLAKE2b-256 checksum
How to use checksums
eb68023201248dcd48180817f8c541c16ef9c234551d18cd649e6ec0ae214fc5
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.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.2-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
3244ed8dcf3b6e2432f65d471731942d7e0ad8626801d1f251bb87e49a030797
BLAKE2b-256 checksum
How to use checksums
e9dd24dbaf66aa9bb674089fd65a735204f7b350124d97b0bffc09adfd4cc8d5
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.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL yabi_torch-0.1.2-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
cf32d754fbbfbf98abff57632288f9e6b862f6d000297dfb19aee6b9d36dae8a
BLAKE2b-256 checksum
How to use checksums
3e5ac92311c4fad0739b932e4194c42c9cbf6a043165cb248d1bcedc7209b7b1
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.2

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