Skip to content

Commit 127fff9

Browse files
authored
Update README.md
1 parent f76442f commit 127fff9

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,19 @@ func_on_3d(arr_3d) # static type checker: OK
7979
func_on_any_arr(arr_3d) # static type checker: OK
8080
```
8181

82-
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.
82+
83+
Write easy-to-understand interfaces using common dimension names (or make up your own):
84+
85+
```python
86+
from phantom_tensors.torch import Tensor
87+
from phantom_tensors.words import Batch, Embed, Vocab
88+
89+
def embedder(x: Tensor[Batch, Vocab]) -> Tensor[Batch, Embed]:
90+
...
91+
```
92+
93+
94+
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.
8395

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

119131
```
120132

121-
Write easy-to-understand interfaces using common dimension names (or make up your own):
122-
123-
```python
124-
from phantom_tensors.torch import Tensor
125-
from phantom_tensors.words import Batch, Embed, Vocab
126-
127-
def embedder(x: Tensor[Batch, Vocab]) -> Tensor[Batch, Embed]:
128-
...
129-
```
130-
131133
## Installation
132134

133135
```shell

0 commit comments

Comments
 (0)