torchdiffeq
ODE solvers and adjoint sensitivity analysis in PyTorch.
Decision gist · record as of 2026-08-14
Yes, if you need differentiable ODE solving in PyTorch. The library is well-established (6472 stars, top 5000 PyPI), has low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status (631 days since release) is a minor concern but the repo remains active. Install it when you're building neural ODEs, physics-informed models, or any system requiring gradients through ODE solutions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- When using odeint_adjoint, func must be a torch.nn.Module to collect parameters; direct function callables will not work with the adjoint method.
- Low friction install with only torch and scipy as runtime dependencies.
- Package is aging (631 days since last release) but repository remains active and unarchived with strong community adoption (6472 stars).
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
last release 2024-11-21 (631 days) · last repo commit 2025-04-04 · 6,472 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,067,062 downloads/mo, #4,412 on PyPI
Alternatives
Verify before relying
pip install torchdiffeq
from torchdiffeq import odeint
# Solve dy/dt = f(t, y) with initial condition y0 at times t
result = odeint(func, y0, t)
# For memory-efficient backprop through adjoint method:
from torchdiffeq import odeint_adjoint as odeint
result = odeint(func, y0, t) # func must be nn.Module- Whether the adjoint method's O(1) memory claim holds for all problem sizes and solver configurations in practice.
- Performance characteristics on GPU versus CPU for typical problem scales.
- Numerical stability guarantees for backpropagation through different solver methods beyond dopri5.
What it is and what it does
torchdiffeq is a PyTorch library for solving ordinary differential equations (ODEs) with full support for automatic differentiation. It implements the main interface `odeint` which solves initial value problems of the form dy/dt = f(t, y) with y(t_0) = y_0, supporting multiple solver algorithms (Runge-Kutta variants, Adams methods, and others) and GPU execution.
The key capability is backpropagation through ODE solutions: you can compute gradients with respect to the initial condition, parameters, and time points. For deep learning applications, it provides an adjoint method that trades computation for memory, using O(1) memory during backprop by solving an adjoint ODE in the backward pass. The library also supports event-based termination (stopping when a condition is met) with differentiable event times and states, useful for physics-informed neural networks and other scientific computing tasks.
Use it for
- Training neural ODEs where the model is defined as a differential equation and gradients flow through the solver.
- Physics-informed neural networks that need to differentiate through ODE solutions with memory efficiency.
- Simulating and learning dynamics in continuous-time systems (e.g., bouncing ball, learned physics models).
- Sensitivity analysis where you need gradients of ODE solutions with respect to parameters or initial conditions.
- GPU-accelerated scientific computing requiring both forward ODE integration and backpropagation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need differentiable ODE solving in PyTorch.
The library is well-established (6472 stars, top 5000 PyPI), has low install friction, permissive licensing, and no known vulnerabilities. The aging maintenance status (631 days since release) is a minor concern but the repo remains active. Install it when you're building neural ODEs, physics-informed models, or any system requiring gradients through ODE solutions.
Install
torchdiffeq on PyPI
Before you install
Low friction install with only torch and scipy as runtime dependencies. Package is aging (631 days since last release) but repository remains active and unarchived with strong community adoption (6472 stars).
When using odeint_adjoint, func must be a torch.nn.Module to collect parameters; direct function callables will not work with the adjoint method.
License in practice
MIT license (permissive) means you can use this freely in commercial and private projects with minimal restrictions.
Quickstart
pip install torchdiffeq
from torchdiffeq import odeint
# Solve dy/dt = f(t, y) with initial condition y0 at times t
result = odeint(func, y0, t)
# For memory-efficient backprop through adjoint method:
from torchdiffeq import odeint_adjoint as odeint
result = odeint(func, y0, t) # func must be nn.Module
Verify before relying
- Whether the adjoint method's O(1) memory claim holds for all problem sizes and solver configurations in practice.
- Performance characteristics on GPU versus CPU for typical problem scales.
- Numerical stability guarantees for backpropagation through different solver methods beyond dopri5.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release ~=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestorchscipy |
| Maintenance | Aging 631 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,067,062 / month, #4,412 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 |
Evidence: torchdiffeq-0.2.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytorch ode solver”
- torchdiffeqProvides PyTorch-based ODE solvers with backpropagation support…
- pybammsolverspybammsolvers provides a Python interface to the IDAKLU solver, a…
- torchcdeProvides differentiable GPU-capable solvers for controlled…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also torchcde · torchsde · diffrax · pybammsolvers · optimistix · autograd · pytorch_revgrad · torch-optimizer · adam-atan2-pytorch · POT