Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rsokl authored Mar 6, 2023
1 parent f76442f commit 127fff9
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,19 @@ func_on_3d(arr_3d) # static type checker: OK
func_on_any_arr(arr_3d) # static type checker: OK
```

Using a runtime type checker, such as [beartype](https://github.com/beartype/beartype), in conjunction with `phantom_tensors` means that the typed shape information will be validated at runtime across a function's inputs and outputs, whenever that function is called.

Write easy-to-understand interfaces using common dimension names (or make up your own):

```python
from phantom_tensors.torch import Tensor
from phantom_tensors.words import Batch, Embed, Vocab

def embedder(x: Tensor[Batch, Vocab]) -> Tensor[Batch, Embed]:
...
```


Using a runtime type checker, such as [beartype](https://github.com/beartype/beartype) or [typeguard](https://github.com/agronholm/typeguard), in conjunction with `phantom_tensors` means that the typed shape information will be validated at runtime across a function's inputs and outputs, whenever that function is called.

```python
from typing import TypeVar, cast
Expand Down Expand Up @@ -118,16 +130,6 @@ z = buggy_matmul(x, y) # Runtime validation error!

```

Write easy-to-understand interfaces using common dimension names (or make up your own):

```python
from phantom_tensors.torch import Tensor
from phantom_tensors.words import Batch, Embed, Vocab

def embedder(x: Tensor[Batch, Vocab]) -> Tensor[Batch, Embed]:
...
```

## Installation

```shell
Expand Down

0 comments on commit 127fff9

Please sign in to comment.