| ▲ | Scene_Cast2 6 hours ago | |
Are there any good static (i.e. not runtime) type checkers for arrays and tensors? E.g. "16x64x256 fp16" in numpy, pytorch, jax, cupy, or whatever framework. Would be pretty useful for ML work. | ||
| ▲ | ocamoss 5 hours ago | parent | next [-] | |
We're working on statically checking Jaxtyping annotations in Pyrefly, but it's incomplete and not ready to use yet :) | ||
| ▲ | 5 hours ago | parent | prev | next [-] | |
| [deleted] | ||
| ▲ | dcreager 6 hours ago | parent | prev | next [-] | |
There have been some early proposals to add something like that, but none of them have made it very far yet. As you might imagine, it's a hard problem! | ||
| ▲ | westurner 4 hours ago | parent | prev [-] | |
- /?hnlog pycontract icontract https://westurner.github.io/hnlog/ : From https://news.ycombinator.com/item?id=14246095 (2017) : > PyContracts supports runtime type-checking and value constraints/assertions (as @contract decorators, annotations, and docstrings). > Unfortunately, there's yet no unifying syntax between PyContracts and the newer python type annotations which MyPy checks at compile-type. Or beartype. Pycontracts has: https://andreacensi.github.io/contracts/ :
For icontract, there's icontract-hyothesis.parquery/icontract: https://github.com/Parquery/icontract : > There exist a couple of contract libraries. However, at the time of this writing (September 2018), they all required the programmer either to learn a new syntax (PyContracts) or to write redundant condition descriptions ( e.g., contracts, covenant, deal, dpcontracts, pyadbc and pcd).
icontract with numpy array types: | ||