-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Hi,
I have recently started using this library, so i might be using it incorrectly, but linting seems to fail in pycharm when assigning the result of torch.randn to TensorType with a float dtype.
Here is an example:
Matrix = TensorType['h', 'w', float]
x: Matrix = torch.randn(5, 3)
The second line gets underlined with the following error:
Expected type 'TensorType[Any, Any, float]', got 'Tensor' instead
If i modify the second line to:
x: Matrix = torch.randn(5, 3).float()
The error goes away, but I would rather not do that as one of the plus sides of this library is to remove extra typing related code from my main logic. Having to add an implicit .float defeats the purpose of this library IMO.
From reading the docs this should work, torch.randn returns a tensor the the deafult dtype, and TensorTypes that have float in them should be of the default type.
baon6052 and fzyzcjy
Metadata
Metadata
Assignees
Labels
No labels