RuntimeError: No CUDA GPUs are available报错解决

当程序中存在时,

torch._C._cuda_init()

报错RuntimeError: No CUDA GPUs are available。

首先考虑两点:
1、torch是否是gpu版本
2、在下方语句所在文件,添加cuda检测

****.to(device)

cuda检测

torch.cuda.device_count()
torch.cuda.is_available()
torch.cuda.device_count()

3、继续百度

你可能感兴趣的:(学习笔记,python)