pytorch查看模型文件的字典数据

 

 

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()字典用法;

上一篇:入门Kubernetes-StatefulSets


下一篇:[Mybatis] SpringBoot -mybatis 常用mysql数据库交互