模型保存
torch.save(model.state_dict(), '文件路径/文件名.pth')
模型恢复
model = Your_defined_Model_Class
model.load_state_dict(torch.load('文件路径/文件名.pth'))
模型评估
model.eval()
out = model(input)
官方文档
https://pytorch.org/tutorials/beginner/saving_loading_models.html