Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! 在加入中断训练代码之后,从中断处训练,出现了保存的模型和优化器权重不在同一设备下的错误。在网上搜索之后,找到了许多解决方法,但都不适合我,在这里做一下总结