通用的PyTorch模型保存和加载模板 保存模型 state = { 'model': model.state_dict(), 'optimizer':optimizer.state_dict(), 'epoch': epoch } torch.save(state