在VSCODE中使用torch.tensor报如下错误,最开始以为是我自己写代码的问题

VSCODE的pylint忽略其规范错误,但运行没错;torch.tensor is not callable

后面测试了一下最简单的程序,发现是能运行的

VSCODE的pylint忽略其规范错误,但运行没错;torch.tensor is not callable

在网上查了一下应该是VSCODE的pylint代码规范的问题,不会影响结果的,不过确实是太丑了这个红色波浪线

于是找了一下方法,可以在setting.json文件中的    "python.linting.pylintArgs":   添加如下字段:,"--disable-msg=not-callable"

VSCODE的pylint忽略其规范错误,但运行没错;torch.tensor is not callable它这个意思就是你想要的忽略的报错问题,not-callable可以换成一系列错误码就可以对有这类错误码的报错直接忽略;

错误码具体操作参考文章:https://blog.csdn.net/cowry5/article/details/79735845

然后前两句是解决      pylint报错Module torch has no xxx member    这个问题的,也可以参考一下;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
猜你喜欢
  • 2022-01-07
  • 2021-09-11
  • 2021-10-22
  • 2021-06-23
  • 2021-08-06
  • 2021-07-24
  • 2021-11-13
相关资源
相似解决方案