Efficiently get the index-0 element of an iterable.
Project description
jax-bounded-while
Bounded while loop in JAX.
This is a micro-package, containing the single function bounded_while_loop.
Reverse-mode-friendly, bounded while_loop implemented via lax.scan.
Installation
pip install jax-bounded-while
Examples
Simple loop over a scalar:
import jax.numpy as jnp
from jax_bounded_while import bounded_while_loop
def cond_fn(x):
return x < 5
def body_fn(x):
return x + 1
result = bounded_while_loop(cond_fn, body_fn, jnp.asarray(0), max_steps=10)
print(result) # Array(5, dtype=int32)
PyTree carry (tuple):
import jax.numpy as jnp
from jax_bounded_while import bounded_while_loop
def cond_fn(state):
x, _ = state
return x < 3
def body_fn(state):
x, y = state
return x + 1, y * 2
result = bounded_while_loop(
cond_fn, body_fn, (jnp.asarray(0), jnp.asarray(1)), max_steps=5
)
print(result) # (Array(3, dtype=int32), Array(8, dtype=int32))
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_bounded_while-0.1.tar.gz.
File metadata
- Download URL: jax_bounded_while-0.1.tar.gz
- Upload date:
- Size: 149.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb69ed3f90f7f65f751947861a4ecbbaac71cef623b738c15f86a5309a4788a
|
|
| MD5 |
83654a5a86b17a5f4556921243e3ab47
|
|
| BLAKE2b-256 |
09f740203b0a258d1d4398fff25e50fab6fbbed81be45b7b74267b118b13d82f
|
Provenance
The following attestation bundles were made for jax_bounded_while-0.1.tar.gz:
Publisher:
cd.yml on GalacticDynamics/jax-bounded-while
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_bounded_while-0.1.tar.gz -
Subject digest:
efb69ed3f90f7f65f751947861a4ecbbaac71cef623b738c15f86a5309a4788a - Sigstore transparency entry: 907354888
- Sigstore integration time:
-
Permalink:
GalacticDynamics/jax-bounded-while@28cc35239715629bb44ce09e65f032639e196556 -
Branch / Tag:
refs/tags/v0.1 - Owner: https://github.com/GalacticDynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@28cc35239715629bb44ce09e65f032639e196556 -
Trigger Event:
release
-
Statement type:
File details
Details for the file jax_bounded_while-0.1-py3-none-any.whl.
File metadata
- Download URL: jax_bounded_while-0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
752c33939eee34be808c699b140e43db8b3a5f22f72841a55fb2927a6aa876cb
|
|
| MD5 |
fd0e2b0f6f334206b98955e78996d13a
|
|
| BLAKE2b-256 |
01f969effe844743fdeea433c5fe140d9cc9fd7003573ef406c090c34b4f9dde
|
Provenance
The following attestation bundles were made for jax_bounded_while-0.1-py3-none-any.whl:
Publisher:
cd.yml on GalacticDynamics/jax-bounded-while
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jax_bounded_while-0.1-py3-none-any.whl -
Subject digest:
752c33939eee34be808c699b140e43db8b3a5f22f72841a55fb2927a6aa876cb - Sigstore transparency entry: 907354889
- Sigstore integration time:
-
Permalink:
GalacticDynamics/jax-bounded-while@28cc35239715629bb44ce09e65f032639e196556 -
Branch / Tag:
refs/tags/v0.1 - Owner: https://github.com/GalacticDynamics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@28cc35239715629bb44ce09e65f032639e196556 -
Trigger Event:
release
-
Statement type: