So we've had type hints for a lot of PyTorch in Feb 2019 after working on it since Oct 2018.
I must say that of the 140 or so features and bug-fixes this was the singular most draining thing to work on, mainly from the comments on the bug reports.
But I'm glad if it sparks more joy now.
The shape vs. type is something that many people want, part of the problem is that shapes do depend on inputs. Often on input values (often constant ones) rather than types (convolution padding, "kernel" size in pooling, ...). But you would also need to know the constants from class members. For other bits it's completely unpredictable (like value-based advanced indexing or nonzero or so). So one would really need to be more "dynamic" than the static type annotations (meta-programming).
There is a bug open around that, but I haven't really followed along.
The other part is that I personally think that stubs (pyi) rather than inline type annotations are 1) wrong, because they'll go out of date, 2) ruin the joy. But the Python 2 compat everyone wanted last year kept us using them.
I must say that of the 140 or so features and bug-fixes this was the singular most draining thing to work on, mainly from the comments on the bug reports.
But I'm glad if it sparks more joy now.
The shape vs. type is something that many people want, part of the problem is that shapes do depend on inputs. Often on input values (often constant ones) rather than types (convolution padding, "kernel" size in pooling, ...). But you would also need to know the constants from class members. For other bits it's completely unpredictable (like value-based advanced indexing or nonzero or so). So one would really need to be more "dynamic" than the static type annotations (meta-programming).
There is a bug open around that, but I haven't really followed along.
The other part is that I personally think that stubs (pyi) rather than inline type annotations are 1) wrong, because they'll go out of date, 2) ruin the joy. But the Python 2 compat everyone wanted last year kept us using them.