Execute runtime assertions, indexing checks, and more if jax code is not traced.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jax_ifnt-0.1.11.tar.gz.
File metadata
- Download URL: jax_ifnt-0.1.11.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff7757360411e7c68b3a9954ce729ff7a50ed3c440e4f90b729a1c73c63b344
|
|
| MD5 |
d7d2a77fae4d8ceb188f323aab2fc5f8
|
|
| BLAKE2b-256 |
01d27d1e8bbb7e635dfca0f30dd28a5da66cc292e6dfd5129afa8c275efad9d2
|
Provenance
The following attestation bundles were made for jax_ifnt-0.1.11.tar.gz:
Publisher:
publish.yml on tillahoffmann/jax-ifnt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_ifnt-0.1.11.tar.gz -
Subject digest:
aff7757360411e7c68b3a9954ce729ff7a50ed3c440e4f90b729a1c73c63b344 - Sigstore transparency entry: 306443340
- Sigstore integration time:
-
Permalink:
tillahoffmann/jax-ifnt@8ab3fe1e09df1a905712abc4970dfb7e47fdc3d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ab3fe1e09df1a905712abc4970dfb7e47fdc3d4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file jax_ifnt-0.1.11-py3-none-any.whl.
File metadata
- Download URL: jax_ifnt-0.1.11-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1195acd83ec8cfd7f8c788fe0807108e6331cdd8c5a21af88af2f6ed19cf8599
|
|
| MD5 |
299a3edcc8b7ec4ebe8d37064f4f2da4
|
|
| BLAKE2b-256 |
e0228df1e587909626f838e863e0cfc981ac005d2e50a0cd605666cc466c7de5
|
Provenance
The following attestation bundles were made for jax_ifnt-0.1.11-py3-none-any.whl:
Publisher:
publish.yml on tillahoffmann/jax-ifnt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_ifnt-0.1.11-py3-none-any.whl -
Subject digest:
1195acd83ec8cfd7f8c788fe0807108e6331cdd8c5a21af88af2f6ed19cf8599 - Sigstore transparency entry: 306443344
- Sigstore integration time:
-
Permalink:
tillahoffmann/jax-ifnt@8ab3fe1e09df1a905712abc4970dfb7e47fdc3d4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ab3fe1e09df1a905712abc4970dfb7e47fdc3d4 -
Trigger Event:
push
-
Statement type: