Skip to main content

Taylor-mode automatic differentiation for PyTorch

Project description

Taylor Mode Autodiff in PyTorch

This library provides a PyTorch implementation of Taylor mode automatic differentiation, a generalization of forward mode to higher-order derivatives. It is similar to JAX's Taylor mode (jax.experimental.jet).

The repository also hosts the Python functionality+experiments and LaTeX source for our NeurIPS 2025 paper "Collapsing Taylor Mode Automatic Differentiation", which allows to further accelerate Taylor mode for many practical differential operators.

Operator coverage is still growing, so please help us improve the package by providing feedback, filing issues, and opening pull requests.

Taylor mode propagates the jet of an input curve through a function to obtain the jet of the output curve

Getting Started

Installation

pip install jet-for-pytorch

Quickstart

Compute the third-order derivative of a scalar function with jet:

from torch import tensor, ones_like, zeros_like
from jet import jet

f = lambda x: x**4  # f'''(x) = 24 * x

x = tensor(2.0)
f_jet = jet(f, (x,))  # (x₀, x₁, x₂, x₃) ↦ (f₀, f₁, f₂, f₃)

# x₀ = x, x₁ = 1, x₂ = x₃ = 0 ⇒ f₃ = f'''(x)
f0, f1, f2, f3 = f_jet((x, ones_like(x), zeros_like(x), zeros_like(x)))

assert f3.allclose(24 * x)  # third derivative matches by hand

For the full list of supported operators, see the supported operations section of the introductory tutorial.

Examples

See the documentation.

Citing

If you find the jet package useful for your research, consider citing

@inproceedings{dangel2025collapsing,
  title =        {Collapsing Taylor Mode Automatic Differentiation},
  author =       {Felix Dangel and Tim Siebert and Marius Zeinhofer and Andrea
                  Walther},
  year =         2025,
  booktitle =    {Advances in Neural Information Processing Systems (NeurIPS)},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jet_for_pytorch-1.0.0.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jet_for_pytorch-1.0.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file jet_for_pytorch-1.0.0.tar.gz.

File metadata

  • Download URL: jet_for_pytorch-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jet_for_pytorch-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2ece4e257951abe63970f7e71c80b32c21051428ac27b04feb2a807c0a67204a
MD5 24dde7195c0d7201c1c08d58f6485005
BLAKE2b-256 6d97fb5d34a84202a5ed589ee65e375ece8e42c01d5b5c9b46ff4fa7bb93227e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jet_for_pytorch-1.0.0.tar.gz:

Publisher: python-publish.yaml on f-dangel/torch-jet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jet_for_pytorch-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jet_for_pytorch-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d36b0fe323717acd4208e99194a7e2e316bc013f5c8c480560bef56848bc09d7
MD5 196e439a7362c5f2440a1fa39116fe4b
BLAKE2b-256 06151ec3404d8ff98b6251027c6787133eba9f17bddb72a72171479a98c38ed5

See more details on using hashes here.

Provenance

The following attestation bundles were made for jet_for_pytorch-1.0.0-py3-none-any.whl:

Publisher: python-publish.yaml on f-dangel/torch-jet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page