A library for key management in JAX.
Project description
randomix - Random Jax utilities
Miscellaneous things related to jax and random numbers.
For now, just the Keyer class.
(This package is an experiment with aider, uv, and what it takes to ship a pypi package)
Version
0.1.1
New Typed Keys
The new typed keys in JAX are represented as scalar arrays with a special RNG dtype that
satisfies jnp.issubdtype(key.dtype, jax.dtypes.prng_key). This library ensures that the keys
are of the new typed format and provides methods to split them into sub-keys based on a given shape.
For more information on the new typed keys, see the JAX documentation: https://docs.jax.dev/en/latest/jep/9263-typed-keys.html#notes-for-jax-library-authors
Keyer
The randomix.Keyer class handles jax.random.PRNGKey state
storage within a single jit context.
Similar to e.g. treex.KeySeq but slightly more convenient API. (I've seen this basic concept in other places as well).
Usage:
key = jax.random.key(42) # Create a PRNG key through the new Jax API
keyer = randomix.Keyer(key)
other_key = keyer() # Split a new key, update key held inside keyer
more_keys = keyer((3, 2)) # Get keys with a shape
Note that you should not pass a keyer around jit borders or vmap lambdas or anything like that; just pass the split keys.
Open question: would it be convenient to just mirror all the jax.random
methods that take key as an argument to this class?
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 randomix-0.1.1.tar.gz.
File metadata
- Download URL: randomix-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76efbad21e6a4961d66b2f686a8b5aa91741eeb2f8f102bb4a97d535d36e03c6
|
|
| MD5 |
7fc113a90849be1dc530a65875dca74c
|
|
| BLAKE2b-256 |
1cda05733265e9052f436ed09e816e5208ba4e051816dca0aeb70f5073c0c965
|
Provenance
The following attestation bundles were made for randomix-0.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on tjltjl/randomix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
randomix-0.1.1.tar.gz -
Subject digest:
76efbad21e6a4961d66b2f686a8b5aa91741eeb2f8f102bb4a97d535d36e03c6 - Sigstore transparency entry: 173238506
- Sigstore integration time:
-
Permalink:
tjltjl/randomix@d20d04938609a07bc826eb821d680f75b763b101 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/tjltjl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d20d04938609a07bc826eb821d680f75b763b101 -
Trigger Event:
push
-
Statement type:
File details
Details for the file randomix-0.1.1-py3-none-any.whl.
File metadata
- Download URL: randomix-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.0 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 |
c49c40ffb33d8e237a29db4de2771ec4ea9e65e30668575eaa99157b650bdfa1
|
|
| MD5 |
795a08342896b648d946c415d2e08d1c
|
|
| BLAKE2b-256 |
fa1f8c9f4c94ac0e3ffb53a6ec40a690415b39b43a87af65513674e4979e8dfe
|
Provenance
The following attestation bundles were made for randomix-0.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on tjltjl/randomix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
randomix-0.1.1-py3-none-any.whl -
Subject digest:
c49c40ffb33d8e237a29db4de2771ec4ea9e65e30668575eaa99157b650bdfa1 - Sigstore transparency entry: 173238507
- Sigstore integration time:
-
Permalink:
tjltjl/randomix@d20d04938609a07bc826eb821d680f75b763b101 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/tjltjl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@d20d04938609a07bc826eb821d680f75b763b101 -
Trigger Event:
push
-
Statement type: