MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / save_model

Function save_model

VAE_AutoEncoder/utils.py:21–32  ·  view source on GitHub ↗

:param model: :param epoch: :return:

(model,optimizer,epoch)

Source from the content-addressed store, hash-verified

19
20#保存模型
21def save_model(model,optimizer,epoch):
22 """
23 :param model:
24 :param epoch:
25 :return:
26 """
27 print("=> Saving checkpoint")
28 checkpoint = {
29 "state_dict": model.state_dict(),
30 "optimizer": optimizer.state_dict(),
31 }
32 torch.save(checkpoint, os.path.join(config.SAVE_MODELS,str(epoch)+'gen.tar'))
33
34
35def load_checkpoin(checkpoint_file, model, optimizer, lr):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected