cpu上训练的模型放到gpu上跑:
torch.load(‘model1.pth’, map_location=lambda storage, loc: storage.cuda(0))

更多推荐