You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEP 646 has been accepted for Python 3.11. The typing_extensions package provides an implementation for earlier Python versions.
At the time of writing, pyright fully supports this PEP, but mypy not just yet (python/mypy#12280)
The TypeVarTuple that this PEP introduces, could be used here to unify all separate e.g. Tensor1[T1], Tensor2[T1, T2], ... types into one Tensor[*T] type, significantly reducing the complexity of the array types in this package.
Are there any plans on implementing this at the moment?
The text was updated successfully, but these errors were encountered:
The longer version is that there are two key factors here:
It looks like it's going to be a while before PEP 646 is widely supported. At the minimum, I think we'd want good support in both mypy and pytype. (pytype support is important because it's what we use at DeepMind.)
Part of the reason we made TensorAnnotations was as a proof-of-concept, to provide evidence for the viability of PEP 646. Eventually, TensorAnnotations will hopefully not be needed, because the corresponding features will be part of libraries like TensorFlow and JAX themselves, using the features from PEP 646. So it might be the case that by the time PEP 646 is widely supported, some support for PEP 646-style annotations will already be present in the corresponding libraries.
I'll close this for now, but we might revisit this question depending on how things play out.
PEP 646 has been accepted for Python 3.11. The typing_extensions package provides an implementation for earlier Python versions.
At the time of writing, pyright fully supports this PEP, but mypy not just yet (python/mypy#12280)
The
TypeVarTuple
that this PEP introduces, could be used here to unify all separate e.g.Tensor1[T1]
,Tensor2[T1, T2]
, ... types into oneTensor[*T]
type, significantly reducing the complexity of the array types in this package.Are there any plans on implementing this at the moment?
The text was updated successfully, but these errors were encountered: