Skip to main content

distreqx

Distrax + Equinox = distreqx. Easy Pytree probability distributions and bijectors.

distreqx (pronounced "dist-rex") is a JAX-based library providing implementations of distributions, bijectors, and tools for statistical and probabilistic machine learning with all benefits of jax (native GPU/TPU acceleration, differentiability, vectorization, distributing workloads, XLA compilation, etc.).

The origin of this package is a reimplementation of distrax, (which is a subset of TensorFlow Probability (TFP), with some new features and emphasis on jax compatibility) using equinox. As a result, much of the original code/comments/documentation/tests are directly taken or adapted from distrax (original distrax copyright available at end of README.)

Current features include:

  • Probability distributions
  • Bijectors

Installation

pip install distreqx

or

git clone https://github.com/lockwo/distreqx.git
cd distreqx
pip install -e .

Requires Python 3.10+, JAX 0.4.11+, and Equinox 0.11.0+.

Documentation

Available at https://lockwo.github.io/distreqx/.

Quick example

import jax
from jax import numpy as jnp
from distreqx import distributions

key = jax.random.key(1234)
mu = jnp.array([-1., 0., 1.])
sigma = jnp.array([0.1, 0.2, 0.3])

dist = distributions.MultivariateNormalDiag(mu, sigma)

samples = dist.sample(key)

print(dist.log_prob(samples))

Differences with Distrax

  • No official support/interoperability with TFP
  • The concept of a batch dimension is dropped. If you want to operate on a batch, use vmap (note, this can be used in construction as well, e.g. vmaping the construction of a ScalarAffine)
  • Broader pytree enablement
  • Strict abstract/final design pattern

Citation

If you found this library useful in academic research, please cite:

@software{lockwood2024distreqx,
  title = {distreqx: Distributions and Bijectors in Jax},
  author = {Owen Lockwood},
  url = {https://github.com/lockwo/distreqx},
  doi = {10.5281/zenodo.13764512},
}

(Also consider starring the project on GitHub.)

See also: other libraries in the JAX ecosystem

GPJax: Gaussian processes in JAX.

flowjax: Normalizing flows in JAX.

Optimistix: root finding, minimisation, fixed points, and least squares.

Lineax: linear solvers.

sympy2jax: SymPy<->JAX conversion; train symbolic expressions via gradient descent.

diffrax: numerical differential equation solvers in JAX. Autodifferentiable and GPU-capable.

Awesome JAX: a longer list of other JAX projects.

Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================

Metadata

Release files for distreqx 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for distreqx 0.0.3
File Size Uploaded
distreqx-0.0.3.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for distreqx 0.0.3
File Interpreter ABI Platform
distreqx-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 97.9 kB

Release files / distreqx-0.0.3.tar.gz

Download URL distreqx-0.0.3.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5c38547d13dbfbb06275433561651dea6546cb23f3a7064f17612ea60348442b
BLAKE2b-256 checksum
How to use checksums
f954697a3e912ec053bec9ad1b1060e9ab12534bbb0e4ffd06587929894adf61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release files / distreqx-0.0.3-py3-none-any.whl

Download URL distreqx-0.0.3-py3-none-any.whl
Size 57.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f68d7b6e9d1a6f544707906bde933f1586d215db0b928979d14a118fa9b3dcb
BLAKE2b-256 checksum
How to use checksums
f1dd06b1b88a895355b581a4eafb31ef7a41161a67bf48163a76008f91f7304b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page