https://github.com/gpflow/check_shapes
Library for annotating and checking tensor shapes.
https://github.com/gpflow/check_shapes
Last synced: 3 months ago
JSON representation
Library for annotating and checking tensor shapes.
- Host: GitHub
- URL: https://github.com/gpflow/check_shapes
- Owner: GPflow
- License: apache-2.0
- Created: 2022-09-26T08:49:27.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-04-08T10:52:43.000Z (about 1 year ago)
- Last Synced: 2024-04-08T11:49:30.153Z (about 1 year ago)
- Language: Python
- Size: 125 MB
- Stars: 7
- Watchers: 5
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# check_shapes
`check_shapes` is a library for annotating and checking tensor shapes.
For example:```python
import tensorflow as tffrom 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](https://gpflow.github.io/check_shapes).
## Installation
The recommended way to install `check_shapes` is from pypi:
```bash
pip install check_shapes
```### From source
To develop `check_shapes`, check it out from GitHub:
```bash
git clone [email protected]:GPflow/check_shapes.git
```We use [Poetry](https://python-poetry.org/) to install and manage dependencies. Follow their
instructions for how to install Poetry itself. Then:```bash
cd check_shapes
poetry install
```To check you installation run our tests:
```bash
poetry run task test
```For testing with different versions of Python and dependencies, see the `poetryenv` script.