Skip to main content

Tensor shape checks inspired by einstein notation

Project description

eincheck

CI Documentation Status PyPI version

Tensor shape checks inspired by einstein notation

Overview

This library has three main functions:

  • check_shapes takes tuples of (Tensor, shape) and checks that all the Tensors match the shapes
check_shapes((x, "i 3"), (y, "i 3"))
  • check_func is a function decorator to check the input and output shapes of a function
@check_func("*i x, *i y -> *i (x + y)")
def concat(a, b):
    return np.concatenate([a, b], -1)
  • check_data is a class decorator to check the fields of a data class
@check_data(start="i 2", end="i 2")
class LineSegment2D(NamedTuple):
    start: torch.Tensor
    end: torch.Tensor

For more info, read the docs!

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

eincheck-0.6.2.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

eincheck-0.6.2-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file eincheck-0.6.2.tar.gz.

File metadata

  • Download URL: eincheck-0.6.2.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.6 Darwin/24.6.0

File hashes

Hashes for eincheck-0.6.2.tar.gz
Algorithm Hash digest
SHA256 ca32a14a1d1b24a8ba56f0ee47055796893a4337f8fd3b9f40e293804f36aaf7
MD5 d4850474c9c4a5e9e2a8d6771a625ecb
BLAKE2b-256 7d47abd29b1d81888660edcf2a1f54f0ffc9f9cea405f6d7ff9f5e1cefc19895

See more details on using hashes here.

File details

Details for the file eincheck-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: eincheck-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.9.6 Darwin/24.6.0

File hashes

Hashes for eincheck-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 34de20d8e57c7d054a432821eff68f7f75b0c3a01b1b90baf72ef6d2825a52e6
MD5 7e1dea407de95b860de1035fec62d8d0
BLAKE2b-256 1110c2652e0ce71103595e0085d7a6a802d51957344da14604781ae4c963318e

See more details on using hashes here.

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