Why libtorch cannot get 'running_mean' and 'running_var' of BatchNormalization2D in .pt file?

Using a constant input would remove the possibility of a different preprocessing or loading logic between your codes. It’s not needed to initialize the model.
Did you call model.eval() using your model as well? This would be necessary to compare the outputs, as e.g. dropout layers might be used in the models.

Could you use the same workflow (contant inputs and model.eval()) using your model and check the outputs again?

1 Like