-
Notifications
You must be signed in to change notification settings - Fork 23.2k
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
torch.backends
not properly re-exported for static type-checking
#101686
Comments
Hmm, I disagree that it has anything to do with build (or perhaps we need to better define what build means) |
Ok, looks like all it needs to do, is to have |
I don't think so (please correct me if I'm wrong).
We also need something like The same also applies to other |
Doing that implies adding But in all likelihood all |
The
Another option can be a |
I have a fix, but I want to write some sort of regression test for it, because
|
So that `pyright` is happy Do a little refactor in `mps/__init__.py` to avoid cyclical dependency on `torch.fx` by calling `mps._init()` implicitly. Fixes #101686 [ghstack-poisoned]
So that `pyright` is happy Do a little refactor in `mps/__init__.py` to avoid cyclical dependency on `torch.fx` by calling `mps._init()` implicitly. Fixes #101686 [ghstack-poisoned]
🐛 Describe the bug
To reproduce the error message, install VS Code+python/pylance, and enable
"python.analysis.typeCheckingMode": "basic"
.The code above works in runtime but will cause an error in static checking
"backends" is not a known member of module "torch" Pylance(reportGeneralTypeIssues)
Ref: microsoft/pylance-release#4374
It is because
backends
is not re-exported fromtorch
and pylance(pyright) doesn't recognize it.(Of course, manually adding
import torch.backends.cudnn
in user code will make it work, but I think the intended usage is to maketorch.backends.cudnn
available with onlyimport torch
)Versions
master
cc @ezyang @malfet @rgommers @xuzhao9 @gramster @albanD
The text was updated successfully, but these errors were encountered: