code
import torch chpt = torch.load('./CP_epoch1.pth') # epoch = chpt['epoch'] # loss = chpt['loss'] for k, v in chpt.items(): print(k, v)
output():
inc.double_conv.0.weight inc.double_conv.0.bias inc.double_conv.1.weight inc.double_conv.1.bias inc.double_conv.1.running_mean inc.double_conv.1.running_var inc.double_conv.1.num_batches_tracked inc.double_conv.3.weight inc.double_conv.3.bias inc.double_conv.4.weight inc.double_conv.4.bias inc.double_conv.4.running_mean inc.double_conv.4.running_var inc.double_conv.4.num_batches_tracked down1.maxpool_conv.1.double_conv.0.weight down1.maxpool_conv.1.double_conv.0.bias down1.maxpool_conv.1.double_conv.1.weight down1.maxpool_conv.1.double_conv.1.bias down1.maxpool_conv.1.double_conv.1.running_mean down1.maxpool_conv.1.double_conv.1.running_var
......
参考
1. collections.OrderedDict()字典用法;
完