Observed since 20 Oct, 20:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Automatic differentiation for the NumPy code you already write
Advect is a focused automatic differentiation library for scientific Python, with broad NumPy API coverage and first-class support for the Python Array API standard. For repeated workloads, it can stage a function into a reusable, optimized program that can itself be differentiated, saved, and loaded.
python -m pip install advect
# or
conda install -c conda-forge advect
import numpy as np
import advect as ad
def energy(x):
return np.sum(np.sin(x) ** 2)
x = np.array([0.0, 0.5, 1.0])
value, gradient = ad.value_and_grad(energy)(x)
print(f"loss: {value:.6f}")
print("gradient:", np.round(gradient, 6))
# loss: 0.937922
# gradient: [0. 0.841471 0.909297]
value_and_grad evaluates energy and differentiates it with respect to x.
When the same kinds of inputs will run repeatedly, stage the function once:
program = ad.stage(energy, x)
restored = ad.StagedProgram.from_dict(program.to_dict())
print(f"restored loss: {restored(x):.6f}")
# restored loss: 0.937922
From the same code, Advect can compute JVPs, VJPs, Jacobians, Hessians, and higher-order or implicit derivatives. The core API also covers checkpointing and custom primitives. Optional integrations add SciPy and xarray workflows and bridges to other autodiff frameworks.
Other NumPy-focused autodiff projects include HIPS Autograd and MyGrad. Advect also offers optional bridges that let a NumPy-backed function participate in JAX or PyTorch.
Start with the runnable tutorials, then use the API reference and compatibility tables for exact contracts. Contributors should begin with CONTRIBUTING.md and the developer guide.
Report security issues through GitHub's private advisory form. Advect is distributed under the MIT License.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.1 | 4 Oct 2026 | 7 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 20:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:1ce3bc027e8adf1212ec04f4d617862465feab8e8aeccbeaad7029da746aecea