torchcde
Differentiable controlled differential equation solvers for PyTorch with GPU support and memory-efficient adjoint backpropagation.
What it is and what it does
torchcde is a PyTorch library that implements solvers for controlled differential equations (CDEs), a mathematical framework for modeling systems where the evolution of state depends on an external control signal. It is designed specifically for neural network applications, enabling the construction of Neural Controlled Differential Equation models—continuous-time recurrent architectures that excel at handling irregular, variable-length time series with missing data.
The library provides two main components: integrators (the `cdeint` function) that solve the CDE system by computing how state evolves under a control signal, and interpolation schemes that construct smooth continuous controls from discrete, irregularly-sampled data. It supports both standard backpropagation through the solver and memory-efficient adjoint-method backpropagation, with configurable backends (torchdiffeq or torchsde) to leverage different solver implementations. GPU acceleration is built in through PyTorch.
Use it for:
- Build time-series classifiers that handle irregular sampling, variable lengths, and missing values without preprocessing.
- Model financial or sensor data where observations arrive at non-uniform time intervals.
- Implement continuous-time recurrent models as an alternative to LSTMs or Transformers for sequential prediction.
- Train state-space models where the dynamics are controlled by external signals or learned functions.
- Perform adjoint-based training on large time-series datasets where memory efficiency is critical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides differentiable GPU-capable solvers for controlled differential equations (CDEs), enabling Neural Controlled Differential Equation models for irregular time series with support for backpropagation and memory-efficient adjoint methods.
Yes, if you are working on irregular time-series modeling and want a principled continuous-time approach. The library is well-designed and permissively licensed. However, proceed with caution: the project is aging (last release October 2021, no recent commits), so compatibility with the latest PyTorch versions and long-term maintenance are uncertain. Verify that it works with your current environment before committing to production use.
Install
torchcde on PyPI
pip
pip install torchcdeuv
uv add torchcdepoetry
poetry add torchcdeInstalling torchcde
Before you install
Low friction installation as a pure Python wheel. Maintenance is aging—last release was October 2021 and the repository shows no recent commits, though it remains unarchived with 487 stars. Depends on torch, torchdiffeq, and torchsde, all of which are established libraries.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the code provided you include a copy of the license and state significant changes.
Quickstart
pip install torchcde
import torch
import torchcde
# Interpolate discrete time series data
coeffs = torchcde.hermite_cubic_coefficients_with_backward_differences(x)
X = torchcde.CubicSpline(coeffs)
# Define CDE dynamics and integrate
z = torchcde.cdeint(X=X, func=func, z0=z0, t=X.interval)
Requires PyTorch >=1.7; Python ~=3.6 or later.
Verify before relying
- Whether the aging maintenance status (last release October 2021, no recent commits) affects compatibility with current PyTorch versions or introduces unpatched issues.
- Performance characteristics and memory overhead compared to alternative time-series models for specific use cases.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (~=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — torch, torchdiffeq, torchsde |
| Maintenance | aging — 1,762 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 84,351/month — #14,004 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: torchcde-0.2.5-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
diffraxDiffrax provides numerical solvers for…
permissive · top 15,000 on PyPI
torchdiffeqProvides PyTorch-based ODE solvers with…
permissive · top 5,000 on PyPI
torchsdeSolves stochastic differential equations (SDEs)…
permissive · top 5,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
findiffComputes finite difference numerical…
permissive · top 15,000 on PyPI
nvidia-cusolverProvides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
nvidia-cusparseProvides NVIDIA CUSPARSE native runtime…
unclear · top 1,000 on PyPI
nvidia-cusolver-cu12Provides CUDA solver native runtime libraries…
unclear · top 1,000 on PyPI
time-aware-imputerFills missing values in time-series data while…
permissive · top 15,000 on PyPI
nvidia-cusparse-cu12Provides NVIDIA CUSPARSE native runtime…
unclear · top 1,000 on PyPI