-
Notifications
You must be signed in to change notification settings - Fork 133
Stub method being overshadowed by module #690
Comments
I'm checking this against the LS in master (very different than the released one) which does a much better job with stubs, and can at least do: However, neither
https://github.com/pytorch/pytorch/blob/master/torch/__init__.py#L19 Are you on a different version of Torch which exposes those functions? I'm testing with:
|
Oh. Gross. from torch._C import *
__all__ += [name for name in dir(_C)
if name[0] != '_' and
not name.endswith('Base')] |
Thanks for looking into this! Ya, it's because of dynamic code like that that a type stub was added to aid code completion. You'll see a I opened this issue because I thought the language server would use the information in the stub, and it does seem to with the exception of the I installed the nightly with |
The version of torch I have installed doesn't have those two functions in the stub, so I'll have to switch up and see. With some Just to say so, the visual difference between |
Perfect, thanks.
…On Wed, Mar 6, 2019 at 1:41 PM Jake Bailey ***@***.***> wrote:
Closed #690
<#690>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#690 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA8Svalw-rMq8ib89vt27h5GV-nVYyFqks5vUDYQgaJpZM4bapYE>
.
|
0.2.16 is now available on beta channel. You can set this in your VS Code
|
Confirmed that switching to the beta channel fixes things on my end too. |
With the new PyTorch type stubs (pytorch/pytorch#12500), the stub for the
tensor
method seems to not be utilized by intellisense (example below). I think this is related to the existence of a module calledtensor.py
in the PyTorch package - if I delete that file, then the stub is utilized. Maybe the language server is somehow getting confused between whethertorch.tensor
should be inferred to refer to the module or the method defined in the stub. In this case, it should refer to the stub.The stub for
tensor
indicates it has aTensor
return type, but we see vscode not showingTensor
methods here:Meanwhile the similar

as_tensor
method, which has the same return type, is working:Here are the stub definitions:
I don't have a minimal example at the moment. PyTorch is a big package and in my simple attempts to reduce the problem to a minimal version, VSCode did the right thing, so it's hard for me to tell what exactly is going wrong.
This is with Python 3.7, extension version 2019.5.5433 and VSCode 1.31.1.
The text was updated successfully, but these errors were encountered: