-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pycharm shows an incorrect dtype when assigning torch.randn to a variable #29
Comments
Without having things set up in PyCharm myself it'll be a fair bit of work to diagnose this. If you remove the |
I checked it and yes, there is still an error. Doing Seems that And I guess it's not surprising because |
Hi, is there any updates? |
Yes! I'd recommend trying jaxtyping. Despite the name, it actually works equally well for PyTorch. In particular, it's designed to play much better with static type checkers. |
@patrick-kidger Interesting, thanks for the quick reply! (Never thought "jax" typing would work for "pytorch" before ;) ) |
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
toTensorType
with afloat
dtype.Here is an example:
The second line gets underlined with the following error:
If i modify the second line to:
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, andTensorType
s that havefloat
in them should be of the default type.The text was updated successfully, but these errors were encountered: