Skip to main content

fleqx

Normalizing flows for JAX, built directly on distreqx.

A flow from fleqx is a plain distreqx.distributions.Transformed — there's no flow-specific wrapper, so log_prob, sample, optax training, etc. all work exactly as they would for any other distreqx distribution. As with any distreqx distribution, batches are handled with jax.vmap rather than by passing in arrays with a leading batch axis.

  • fleqx.train.fit accepts an arbitrary pytree for both dist and data -- e.g. a dict of independently-trained distributions and their corresponding data arrays -- not just a single distribution and a single (n, dim) array. Pytree leaves may be None for fields you're not using.
  • Each flow constructor also accepts template= in place of dim, for a distribution over an arbitrary pytree of arrays (e.g. a dict of named variables) instead of a flat vector.

Three flow types are implemented so far: coupling, masked autoregressive, and planar.

Example

import jax.numpy as jnp
import jax.random as jr

import fleqx

key = jr.key(0)
flow = fleqx.coupling_flow(key, dim=2)

sample = flow.sample(jr.key(1))
log_p = flow.log_prob(sample)

data = jr.normal(jr.key(2), (1000, 2))
flow, losses = fleqx.fit(jr.key(3), flow, data)

coupling_flow, masked_autoregressive_flow, planar_flow and fit are also available at their fully-qualified paths (fleqx.flows.coupling_flow, fleqx.train.fit, etc.), alongside the rest of each submodule.

Installation

pip install fleqx

That is enough on its own: fleqx takes its distreqx bijectors and distributions through parax, which works with any version of distreqx and supplies anything the installed one is missing.

See the documentation for the full API.

Acknowledgements

Built on distreqx (Owen Lockwood) and parax (freezing/unwrapping of fixed sub-components, e.g. data='s standardizing layer). The bijectors were ported from flowjax (Daniel Ward), a more complete flows library that's worth using directly if you don't specifically need the distreqx API.

Development

pip install -e ".[test]"
pytest

This library was written by Claude, porting the bijectors directly from flowjax. Behaviour should be nearly identical to flowjax's, though minor differences may remain, and the code hasn't yet had a full human review.

Metadata

Release files for fleqx 0.0.4

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

Source distribution (sdist)

Source distribution for fleqx 0.0.4
File Size Uploaded
fleqx-0.0.4.tar.gz 27.4 kB Details

Built distribution (wheel)

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

Total release size: 51.7 kB

Release files / fleqx-0.0.4.tar.gz

Download URL fleqx-0.0.4.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ab7c4e3e1e74a52a72b16584197383b8349daf899c0e615ca93eebc275709a7
BLAKE2b-256 checksum
How to use checksums
2689cb968a204e93fdf1dce99c4be4ccd9413f57c85eb4ea0731a69d6178ab54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / fleqx-0.0.4-py3-none-any.whl

Download URL fleqx-0.0.4-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
363d817e99f9cef04fee6ed9cdeb5e628c65880f88b217a98eb39eb43b4499f3
BLAKE2b-256 checksum
How to use checksums
d402c3c350f8b33416a864ae33f902962d71e4cb969ddfef4d351f68723b33e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.5

2 release files

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

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