Composable expressions in JAX + Equinox
Project description
eqxpress is a lightweight library for composing expressions over input-output PyTree spaces. It allows you to build deferred computation graphs and abstract syntax trees (ASTs) using standard Python operators.
Since eqxpress is built natively on Equinox, each new instance of AbstractExpression is a new PyTree, and therefore any PyTree leaves (weights, arrays, parameters) are propagated throughout nested operations.
| eqxpress | |
|---|---|
| Author | Gary Allen |
| Homepage | github.com/eqxpress/eqxpress |
| Docs | gvcallen.github.io/eqxpress |
Installation
eqxpress can be installed via pip:
pip install eqxpress
Example: Composing Modules
If you have an existing hierarchy of Equinox modules with matching input/output signatures, simply inheriting from AbstractExpression grants them instant, declarative composition.
A common use case is building composite loss functions for optimization:
import jax.numpy as jnp
from eqxpress import AbstractExpression
class MSELoss(AbstractExpression):
def __call__(self, y_true, y_pred):
return jnp.mean((y_true - y_pred) ** 2)
class L2Regularization(AbstractExpression):
def __call__(self, y_true, y_pred):
return jnp.sum(y_pred ** 2)
# Build a deferred computation graph
total_loss = MSELoss() + 0.01 * L2Regularization()
# Evaluate the combined mapping
y_t = jnp.array([1.0, 0.0])
y_p = jnp.array([0.9, 0.1])
loss_value = total_loss(y_true=y_t, y_pred=y_p)
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 eqxpress-0.0.4.tar.gz.
File metadata
- Download URL: eqxpress-0.0.4.tar.gz
- Upload date:
- Size: 21.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865f40e72f9c9b085d5018f1fa314c12e7c21923561ef5aca61f8628147f7eca
|
|
| MD5 |
bea656c40768013d1ff993dcf9d21be9
|
|
| BLAKE2b-256 |
be02244e29c7dfc657a2be5d6f6f69d2afdb91ca68b6370ef2eb8cc3cc6dfb2e
|
Provenance
The following attestation bundles were made for eqxpress-0.0.4.tar.gz:
Publisher:
publish.yml on gvcallen/eqxpress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eqxpress-0.0.4.tar.gz -
Subject digest:
865f40e72f9c9b085d5018f1fa314c12e7c21923561ef5aca61f8628147f7eca - Sigstore transparency entry: 1417990503
- Sigstore integration time:
-
Permalink:
gvcallen/eqxpress@ae712895996d0e9cfea6011c464d5bc3c870ec2a -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/gvcallen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae712895996d0e9cfea6011c464d5bc3c870ec2a -
Trigger Event:
push
-
Statement type:
File details
Details for the file eqxpress-0.0.4-py3-none-any.whl.
File metadata
- Download URL: eqxpress-0.0.4-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81270bc9a9e32be2ea91f77a8b5cbcc8ebdefab33f728addaa5dbd4d34be9510
|
|
| MD5 |
90a5c281bb165919d32c212eaabfb709
|
|
| BLAKE2b-256 |
553f30f049bbb56fb7d03875bb51d7d67df3ff9aed0803c01fc33e9c65093331
|
Provenance
The following attestation bundles were made for eqxpress-0.0.4-py3-none-any.whl:
Publisher:
publish.yml on gvcallen/eqxpress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eqxpress-0.0.4-py3-none-any.whl -
Subject digest:
81270bc9a9e32be2ea91f77a8b5cbcc8ebdefab33f728addaa5dbd4d34be9510 - Sigstore transparency entry: 1417990530
- Sigstore integration time:
-
Permalink:
gvcallen/eqxpress@ae712895996d0e9cfea6011c464d5bc3c870ec2a -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/gvcallen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae712895996d0e9cfea6011c464d5bc3c870ec2a -
Trigger Event:
push
-
Statement type: