一、原因

当前解释器环境中,没安装torch库

二、解决办法

前提:已经安装PyTorch环境

1、键盘上按快捷键:Ctrl + shift + P

2、输入:Python:Select Interpreter

3、选择PyTorch解释器

Vscode——报错解决:Import “torch“ could not be resolved_pytorch