Can you give more details how you “run in vscode editor”? Is it a feature of the “pytorch snippet” extension?
EDIT: maybe you could open your settings.json (command+,, then click the button on the top-right corner), just make sure that the default python path is the right one.