Skip to main content

Runtime shape contracts and diagnostics for NumPy and JAX

Project description

ShapeGuard

Tests Lint PyPI version Python versions License

Runtime shape contracts and diagnostics for NumPy and JAX.

Installation

pip install shapeguard

Quick Start

from shapeguard import Dim, expects

n, m, k = Dim("n"), Dim("m"), Dim("k")

@expects(a=(n, m), b=(m, k))
def matmul(a, b):
    return a @ b

When shapes don't match, you get clear errors:

ShapeGuardError:
  function: matmul
  argument: b
  expected: (m, k)
  actual:   (5, 7)
  reason:   dimension 'm' bound to 4 from a.shape[1], but got 5 from b.shape[0]

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jax_shapeguard-0.3.0.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jax_shapeguard-0.3.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file jax_shapeguard-0.3.0.tar.gz.

File metadata

  • Download URL: jax_shapeguard-0.3.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_shapeguard-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5a680ca94df6b8c5f3376433072488e06983bb14430ff9ba5f50dd8c1ece09fa
MD5 6f8e96dee26d38a613ca7456b97c276a
BLAKE2b-256 e3f08a97077ce69d47e0c15e309bc7df528f321759a40a274aa1c0ad0906f9c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_shapeguard-0.3.0.tar.gz:

Publisher: publish.yml on jayendra13/jax-shape-guard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jax_shapeguard-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: jax_shapeguard-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jax_shapeguard-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c95e3d08439f16a6d17186938593f5c238006898ad783fe8f2dfc5baabe31a4c
MD5 bb5659267af5b45ce0fd60cb7c136e9d
BLAKE2b-256 131f19e31f5d7db8cddd9fe1a2da1b9fbf76858339282d4d88d10c3a6254545e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_shapeguard-0.3.0-py3-none-any.whl:

Publisher: publish.yml on jayendra13/jax-shape-guard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page