Hi,
I submit this issue in VScode, turn out it should be here.
You can see the discussion: https://github.com/microsoft/vscode-python/issues/11213
Just as the topic said, I have tried lots of methods online, but None is effective.
One suggests add the code in pylint,''generated-members=numpy.,torch.''
Yes, it works for some code(some still have a red line), but other errors can't be marked it out either because of adding the code.
It troubled me a lot, I like VScode, but this is really annoying problem.
@JonOnEarth , in order to fix this you, can add a file called .pylintrc at the root of your project containing this:
[MESSAGES CONTROL]
disable=
no-member,
You can add other error messages after the comma if you want.
This is why we need to disable false positives by default in #3512
Thanks. It absolutely works. But it also can cause some other problems.
For example, some typo errors will not be pointed it out because of this no-member.
The best solution still needs pylint support Pytorch or torch I assume.
You can also disable them one by one with #聽pylint: disable=no-member, if you want to keep the others.
You're right that no-member should not have false positive. It's complicated to fix because the information is contained in C binding. So the fix is probably not going to be quick. Pull request would be welcome as torch is not the only package affected by this :)
I'm closing not because it's invalid but because we have multiple tickets regarding false positive with no-member for libraries with C-binding.
Most helpful comment
You can also disable them one by one with
#聽pylint: disable=no-member, if you want to keep the others.You're right that
no-membershould not have false positive. It's complicated to fix because the information is contained in C binding. So the fix is probably not going to be quick. Pull request would be welcome as torch is not the only package affected by this :)