环境:win0+torch(cpu)
详细报错信息
报错:AssertionError: Torch not compiled with CUDA enabled
解决
查阅资料发现此错误是由于下载的torch没有cuda,所以在运行时会报错,在程序最开始的地方加上:
device = torch.device(“cuda” if torch.cuda.is_available() else “cpu”)
代码其余地方出现.cuda()的地方改成.to(device)就可以在无gpu的环境中运行了。
报错:AssertionError: Torch not compiled with CUDA enabled
参考博客:https://blog.csdn.net/m0_37690102/article/details/108364458

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-06
  • 2021-08-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-13
相关资源
相似解决方案