VSCODE的pylint忽略其规范错误,但运行没错;torch.tensor is not callable
在VSCODE中使用torch.tensor报如下错误,最开始以为是我自己写代码的问题
后面测试了一下最简单的程序,发现是能运行的
在网上查了一下应该是VSCODE的pylint代码规范的问题,不会影响结果的,不过确实是太丑了这个红色波浪线
于是找了一下方法,可以在setting.json文件中的 "python.linting.pylintArgs": 添加如下字段:,"--disable-msg=not-callable"
它这个意思就是你想要的忽略的报错问题,not-callable可以换成一系列错误码就可以对有这类错误码的报错直接忽略;
错误码具体操作参考文章:https://blog.csdn.net/cowry5/article/details/79735845
然后前两句是解决 pylint报错Module torch has no xxx member 这个问题的,也可以参考一下;