I modified the above answer to include the batch index (and fixed a typo). You can use the same approach for standard deviation.
Lastly, recall that you should calculate the mean and standard deviation from your training set only. You then apply those values to your validation and test set.