Execute runtime assertions, indexing checks, and more if jax code is not traced.
Overview
ifnt comprises three core modules, ifnt.util with utility functions, ifnt.testing for runtime assertions, and ifnt.random for stateful random number generation.
>>> import ifnt >>> import jax >>> from jax import numpy as jnp >>> >>> def safe_log(x): ... ifnt.testing.assert_array_less(0, x) ... return jnp.log(x) >>> >>> safe_log(-1) Traceback (most recent call last): ... AssertionError: Arrays are not strictly ordered `x < y` <BLANKLINE> Mismatched elements: 1 / 1 (100%) Max absolute difference among violations: 1 Max relative difference among violations: 1. x: array(0) y: array(-1) >>> >>> jax.jit(safe_log)(-1) Array(nan, dtype=float32, weak_type=True)
Installation
$ pip install jax-ifnt
Relationship to chex
DeepMind’s chex provides similar, often complementary, assertions. While chex requires runtime assertions to be “functionalized” with chex.chexify, ifnt will skip assertions in traced code. This facilitates, for example, verifying that indices are not out of bounds.
Metadata
Release files for jax-ifnt 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jax_ifnt-0.1.11.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jax_ifnt-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / jax_ifnt-0.1.11.tar.gz
| Download URL | jax_ifnt-0.1.11.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aff7757360411e7c68b3a9954ce729ff7a50ed3c440e4f90b729a1c73c63b344
|
|
BLAKE2b-256 checksum How to use checksums |
01d27d1e8bbb7e635dfca0f30dd28a5da66cc292e6dfd5129afa8c275efad9d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Jul 23, 2025.
Transparency logRelease files / jax_ifnt-0.1.11-py3-none-any.whl
| Download URL | jax_ifnt-0.1.11-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1195acd83ec8cfd7f8c788fe0807108e6331cdd8c5a21af88af2f6ed19cf8599
|
|
BLAKE2b-256 checksum How to use checksums |
e0228df1e587909626f838e863e0cfc981ac005d2e50a0cd605666cc466c7de5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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 Jul 23, 2025.
Transparency log