The output of BN layer

I want to kown the bn layer how to calculate the output. I debug the code in /usr/local/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py.

I fix the input, that I only change self.training in

return F.batch_norm(
            input, self.running_mean, self.running_var, self.weight, self.bias,
            self.training or not self.track_running_stats,
            exponential_average_factor, self.eps)
```, the other parameter is same. But the output is different.

I think if `self.training` is True, the bn layer will change `running_mean` and `running_var`, and use in the next batch. Whether bn layer use changed `running_mean` and `running_var` in this batch?

I’ve created this manual approach some time ago for debugging purposes, which might be useful.
Let me know, if you have any questions.