【Pytorch 第二讲】 如何遍历 或者查看Model权重/参数/tesnsor_size/dict_names

for (name, param), (key, value) in zip(network.named_parameters(),network.state_dict().items()):
    print(f"{name}   Tensor size: {param.size()}   {key}   Tensor size: {value.size()}")
    print("\nParameter details:")

State_dict keys:

patch_embed.conv_down.0.weight Tensor size: torch.Size([64, 3, 3, 3])

patch_embed.conv_down.1.weight Tensor size: torch.Size([64])

Parameter details: patch_embed.conv_down.1.bias Tensor size: torch.Size([64])

你可能感兴趣的:(#,Pytorch,pytorch,人工智能,python)