Hi,
I recommend you write your custom batchnorm as you said because BatchNorm functions do not have correction terms for running statistics.
As to implementing your custom batchnorm, you can write your batchnorm by using pytorch funcitons or making custom C++ n/ CUDA extensions reference 5.
FYI as you know, PyTorch have many functions and classes related to BatchNorm as you can see THNN, THCUNN, ATen native, PyTorch 2.
And the bessel correction term exists here 6.