RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0
在加载预训练模型进行训练时,在optimizer.step()行会出现RuntimeError:Expectedalltensorstobeonthesamedevice,butfoundatleasttwodevices,cuda:0 保持模型的代码是torch.save({'epoch':epoch+1,'state_dict':model.state_dict(),'opt_dict':op