Skip to main content

A library for annotating and checking the shapes of tensors.

Project description

check_shapes

check_shapes is a library for annotating and checking tensor shapes. For example:

import tensorflow as tf

from gpflow.experimental.check_shapes import check_shapes

@tf.function
@check_shapes(
    "features: [batch..., n_features]",
    "weights: [n_features]",
    "return: [batch...]",
)
def linear_model(features: tf.Tensor, weights: tf.Tensor) -> tf.Tensor:
    return tf.einsum("...i,i -> ...", features, weights)

For more information see our documentation.

Installation

The recommended way to install check_shapes is from pypi:

pip install check_shapes

From source

To develop check_shapes, check it out from GitHub:

git clone git@github.com:GPflow/check_shapes.git

We use Poetry to install and manage dependencies. Follow their instructions for how to install Poetry itself. Then:

cd check_shapes
poetry install

To check you installation run our tests:

poetry run task test

For testing with different versions of Python and dependencies, see the poetryenv script.

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

check_shapes-1.1.1.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

check_shapes-1.1.1-py3-none-any.whl (45.8 kB view details)

Uploaded Python 3

File details

Details for the file check_shapes-1.1.1.tar.gz.

File metadata

  • Download URL: check_shapes-1.1.1.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.0-1042-azure

File hashes

Hashes for check_shapes-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b699fcb1e60bb17e2c97007e444b89eeeea2a9102ff11d61fb52454af5348403
MD5 c26a332facc3b0d4fea74a6adc255945
BLAKE2b-256 21883d87f9d96acd5fbcf88cb27bc690da0a57f51a05dfabd570d413818be215

See more details on using hashes here.

File details

Details for the file check_shapes-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: check_shapes-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.7.17 Linux/5.15.0-1042-azure

File hashes

Hashes for check_shapes-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b5f6b8fc3e5d63933ef5884aec2a7ded7f2c7e541db1823abdf466a500bd6e
MD5 b031e165372c1d949e323db6e29e5210
BLAKE2b-256 f620bffce56003970ece7fa393232140428325a004bfb0631edb4e2b99df63e9

See more details on using hashes here.

Supported by

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