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.5

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.5
File Size Uploaded
fleqx-0.0.5.tar.gz 27.5 kB Details

Built distribution (wheel)

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

Total release size: 51.7 kB

Release files / fleqx-0.0.5.tar.gz

Download URL fleqx-0.0.5.tar.gz
Size 27.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0a1d708b1ebc04d9fd0f99bf39bf525edfa71c59299f12f01b661c6638fba2af
BLAKE2b-256 checksum
How to use checksums
ccedf9b77fe6257ca72cb3d0e457f8cc23c69197479a4a253b4cd9fd0ec62a3d
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.5-py3-none-any.whl

Download URL fleqx-0.0.5-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f056991ee2c219b093549b803c1e7f858990d07487c300198026f149130a3d0
BLAKE2b-256 checksum
How to use checksums
f6e862eae29525d02a73d4fa8fa5d6286b27c2681b63b85d7988c02b1d85b044
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

This release

0.0.5 This release

2 release files

0.0.4

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