解决办法: 添加参数:map_location="cpu" model = torch.load(r'rstxz.pt',map_location="cpu") 因为之前保存的训练模型文件是用GPU训出来的,现在用CPU跑,