Do we do whitening on batch basis or on dataset basis?

nn.BatchNorm layers will do exactly this for each batch.
The Standard score on the other hand is usually calculated for the whole train set.