How to calculate the mean and the std of cifar10 data

Pytorch is using the following values as the mean and std for the cifar10 data: transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))

I need to understand the concept behind calculating it because this data is 3 channel image and I do not understand what is summed and divided over what and so on. Also if someone can share a code for calculating the mean and the std, would be so thankful.