The first one is part of my Python code which load pth file and change all parameters of resnet-50 manually.
And the second one is part of my libtorch code loading pt file. And according to std::cout output, I cannot see the 4 parameters of BatchNormalization module, only can see bn.weight and bn.bias are the same, and afterward the parameters of following modules have been changed.
# import tensorflow as tf
import torch
import torchvision

from torchvision.models.resnet import ResNet, resnet50, resnet101
from torch.autograd import Variable

if __name__ == '__main__':
    print("%"*60)
    example = torch.ones(1, 3, 1500, 1500)
    example.requires_grad = False
    # example2 = torch.rand(1, 3, 320, 320)

    model_res50 = torchvision.models.resnet50(pretrained=True)
    model_res50_FE = torch.nn.Sequential(*list(model_res50.children())[:-3])
    model_res50_FE.eval()

    model_os2d = torch.load("os2d_v2-train.pth")
    # print("model_os2d", model_os2d['net']['net_feature_maps.conv1.weight'])

    # Transfer Os2dFEWeight to model_os2d_FE_res50
    # ==== layer 0 =========
    model_res50_FE.__dict__['_modules']['0'].weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.conv1.weight'])
    model_res50_FE.__dict__['_modules']['1'].weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.bn1.weight'])
    model_res50_FE.__dict__['_modules']['1'].bias = torch.nn.Parameter(model_os2d['net']['net_feature_maps.bn1.bias'])
    model_res50_FE.__dict__['_modules']['1'].running_mean = model_os2d['net']['net_feature_maps.bn1.running_mean']
    model_res50_FE.__dict__['_modules']['1'].running_var = model_os2d['net']['net_feature_maps.bn1.running_var']
    # model_res50_FE.__dict__['_modules']['1'].num_batches_tracked = model_os2d['net']['net_feature_maps.bn1.num_batches_tracked']
    # ======================

    # ==== layer 1 =========
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].conv1.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.conv1.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn1.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn1.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn1.bias = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn1.bias'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn1.running_mean = model_os2d['net']['net_feature_maps.layer1.0.bn1.running_mean']
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn1.running_var = model_os2d['net']['net_feature_maps.layer1.0.bn1.running_var']
    # model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn1.num_batches_tracked = model_os2d['net']['net_feature_maps.layer1.0.bn1.num_batches_tracked']

    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].conv2.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.conv2.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn2.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn2.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn2.bias = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn2.bias'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn2.running_mean = model_os2d['net']['net_feature_maps.layer1.0.bn2.running_mean']
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn2.running_var = model_os2d['net']['net_feature_maps.layer1.0.bn2.running_var']
    # model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn2.num_batches_tracked = model_os2d['net']['net_feature_maps.layer1.0.bn2.num_batches_tracked']

    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].conv3.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.conv3.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn3.weight = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn3.weight'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn3.bias = torch.nn.Parameter(model_os2d['net']['net_feature_maps.layer1.0.bn3.bias'])
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn3.running_mean = model_os2d['net']['net_feature_maps.layer1.0.bn3.running_mean']
    model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn3.running_var = model_os2d['net']['net_feature_maps.layer1.0.bn3.running_var']
    # # model_res50_FE.__dict__['_modules']['4'].__dict__['_modules']['0'].bn3.num_batches_tracked = model_os2d['net']['net_feature_maps.layer1.0.bn3.num_batches_tracked']

    ...

    model_res50_FE_traced_cell = torch.jit.script(model_res50_FE, example)
    print(model_res50_FE.forward(example))
    print(model_res50_FE.forward(example).size())

    model_res50_FE_traced_cell.save("ResNet50_os2d_FE_1500_witlEval_withScript_Pretrained.pt") # TODO:```


torch::jit::script::Module model_body, model_body_que, model_head;
model_body = torch::jit::load("D:/code/python/one_shot/ResNet50_os2d_FE_1500_witlEval_withScript_Pretrained.pt");
model_body.to(device);
model_body.eval();

for(const auto& abc : model_body.attributes()){

    std::cout << abc.toTensor() << endl << "model_body.modules() module" << endl;
    system("pause");

}