Dear all:
I found the api parameters of nn.BatchNorm2d() and F.batch_norm() is different as :
torch.nn.BatchNorm2d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)

torch.nn.functional.batch_norm(input, running_mean, running_var, weight=None, bias=None, training=False, momentum=0.1, eps=1e-05)

To be concise, in nn.BatchNorm2d, it can set affine=False to not optimize w,b and set track_running_stats=False to only use current batch statistics.
However, There is ONLY one parameter training which I dont know the exact behavior when setting it to True or False with respect to ‘w, b’ and running_mean, running_var??
Thanks.