IDE жалуется что не видит torch но все работает
import torch
print(torch.cuda.is_available())
print(torch.cuda.get_device_name(0))
выдает
True
NVIDIA GeForce RTX 4070
Press any key to continue ...
но почему-то все равно IDE пишет
import "torch" could not be resolved
но торч на месте
Name: torch
Version: 2.5.1+cu121
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: [email protected]
License: BSD-3-Clause
Location: c:\users\Username\appdata\roaming\python\python310\site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: clip, torchvision
PS C:\Users\Username\source\repos\App>
Ответы (1 шт):
Автор решения: vitalii petrenko
→ Ссылка
Попробуйте закрыть ide, в корне проекта удалить папку .idea , затем запустить ide. Мне обычно помогает.