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.0.tar.gz (52.5 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.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eincheck-0.6.0.tar.gz
  • Upload date:
  • Size: 52.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.4 Darwin/23.6.0

File hashes

Hashes for eincheck-0.6.0.tar.gz
Algorithm Hash digest
SHA256 147064cdbc8df041b327360e40870871d93c4305971685a66ff88796f12f99d0
MD5 54dc5662c60a65a5b3f63bd1d95010cb
BLAKE2b-256 c90f24b5ab6b751cdab5a7d0065e69971e95cab90af8624cf753f269c3ba4df0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eincheck-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.4 Darwin/23.6.0

File hashes

Hashes for eincheck-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 495f71fb9380d8160e54a96ca98e6fbe0a672d51a2fbc7a09a60f5446cdda84a
MD5 d98a1466d71cc4b5202b9fa34e375d6e
BLAKE2b-256 5305b0e7b792f486acf34e4b5dce6fcf10f3829ea41671cf77c96221a6189a9c

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