BatchNorm2d computes the mean and standard deviation per channel – that is over the batch, height, and width.
import torch
import torch.nn as nn

bn = nn.BatchNorm2d(64)
bn.weight.data.fill_(1)
bn.bias.data.fill_(0)

x = torch.rand(6,64,224,224)
mu = x.mean(dim=(0,2,3), keepdim=True)
sigma = x.std(dim=(0,2,3), keepdim=True)

x_ = (x-mu)/(sigma+1e-5)
print((bn(x_) - x_).abs().max())  # bn(x_) and x_ are approximately equal