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
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
check_shapes-1.0.0.tar.gz
(32.9 kB
view hashes)
Built Distribution
Close
Hashes for check_shapes-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0911b28ef62a21a0c1d0737077a23a9d124f1b7977a5b72c8c579cdb7fe110cc |
|
MD5 | 424931a88e816f3105d4b4e822d7549a |
|
BLAKE2b-256 | ed9857489c9353c83eb6b7eb939501f8d5cb02d4d3e6d8bbce8aaeec82839144 |