I have a very simple code here
import torch
l = torch.nn.Linear(2,5)
v = torch.FloatTensor([1, 2])
print(l(v))
under torch.FloatTensor
, pylint in visual studio code claims that 'Module torch has no 'FloatTensor' member pylint(no-member).
However, the code works fine. Is this a false positive? How can I disable pylint for this specific instance?
If you are getting the dreaded no-member error, there is a possibility that either: pylint found a bug in your code. You're launching pylint without the dependencies installed in its environment. pylint would need to lint a C extension module and is refraining to do so.
You can easily toggle between enabling and disabling your linter. To switch, open the Command Palette (Ctrl+Shift+P) and select the Python: Enable/Disable Linting command. This will populate a dropdown with the current linting state and options to Enable or Disable Python linting.
Press: CTRL + Shift + P
Click on "Preferences: Open Settings (JSON)"
Add this line into JSON :
"python.linting.pylintArgs": ["--generated-members", "from_json,query"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With