--- id: torchsde version: "0.2.6" license: unclear license_treatment: permissive maintenance: abandoned --- # torchsde — SDE solvers and stochastic adjoint sensitivity analysis in PyTorch. License: permissive · Maintenance: abandoned · Downloads: 1.8M/mo ## What it is and what it does torchsde is a PyTorch library that solves stochastic differential equations with automatic differentiation and GPU acceleration. It implements SDE solvers that support backpropagation through the solution trajectory, enabling end-to-end learning of SDE-based generative and latent-variable models. The library handles both Itô and Stratonovich SDEs with configurable noise types and provides efficient adjoint sensitivity methods for gradient computation. The package is built on torch, numpy, scipy, and trampoline, and is designed for researchers working with neural SDEs, latent SDE models, and SDE-based generative models like GANs. It abstracts away the numerical complexity of SDE solving while maintaining differentiability throughout the computation graph, making it suitable for probabilistic deep learning workflows. Use it for: - Training latent SDE models that fit stochastic processes to time-series data with learned drift and diffusion terms. - Building generative models using neural SDEs as the generator component in adversarial training frameworks. - Performing uncertainty quantification in neural networks by modeling outputs as solutions to SDEs. - Implementing stochastic adjoint sensitivity analysis for gradient-based optimization of SDE parameters. - Prototyping research on continuous-time stochastic processes in deep learning. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Solves stochastic differential equations (SDEs) with GPU support and efficient backpropagation through PyTorch, enabling gradient-based learning of SDE-based models. Yes, if you are actively researching neural SDEs or latent stochastic models and can work with a frozen codebase. The package is well-designed and has no known vulnerabilities, but it is archived and abandoned—no future maintenance or updates should be expected. Use it for research prototyping or as a reference implementation, but be aware that you will be responsible for any fixes or adaptations needed for compatibility with newer PyTorch or Python versions. ## Install pip install torchsde uv add torchsde poetry add torchsde ## Installing torchsde Before you install: Low install friction with a pure-wheel distribution. However, the package is archived and abandoned as of the latest release in September 2023, with no commits since December 2024. Depends on torch, numpy, scipy, and trampoline—all standard scientific Python libraries. License in practice: Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions. Quickstart: pip install torchsde import torch import torchsde class SDE(torch.nn.Module): noise_type = 'general' sde_type = 'ito' def f(self, t, y): return y def g(self, t, y): return y sde = SDE() y0 = torch.zeros(32, 3) ts = torch.linspace(0, 1, 20) ys = torchsde.sdeint(sde, y0, ts) Requires Python >=3.8 and PyTorch >=1.6.0; GPU support depends on a compatible CUDA-enabled PyTorch installation. Verify before relying: - Whether the archived repository will receive security patches or maintenance updates in the future. - Compatibility with recent PyTorch versions beyond 1.6.0 and current Python 3.x releases. - Performance characteristics and numerical stability compared to other SDE solvers. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags stochastic differential equation solver, SDE solver pytorch, neural SDE, differentiable SDE, latent SDE learning, stochastic adjoint sensitivity, SDE backpropagation, stochastic-processes, differentiable-computing, research-code [View on SkillFed](https://skillfed.io/packages/torchsde) · [View on PyPI](https://pypi.org/project/torchsde/)