第一次在pytorch框架下运行程序,出现以下错误:
意思是pytorch运行在gpu上面,而本机却没有安装gpu的pytorch。
解决方法:
torch.load(’./checkpoint.pth.tar’)改为torch.load(’./checkpoint.pth.tar’,map_location=“cpu”)即可。
成功解决torch.load with map_location=torch.device(“cpu”) to map your storages to the CPU
最新推荐文章于 2024-10-14 11:21:29 发布