Yeah thank you that’s indeed what I was looking for, except in my use case, the input is composed of two images (so the input size is [batch_size, 2*channels, h, w]) and I need to jointly normalize both images to get one mean and one std per channel.
So starting from your piece of code, how do I compute statistics not for each channel separately, but for 2 channels at a time ?