Finding the mean per class in Pytorch

I am naively iterating over each and every sample of the dataset. Is there anyway to calculate the mean efficiently ?

my_root = '/mini_imagenet_full_size/train/'
Clmean = []
dir_list = os.listdir(my_root)
print(len(dir_list))
miniImagenet_dataset = datasets.ImageFolder(root=my_root, transform=data_transform)
Clmean=torch.zeros([64,3,224,224])
for t,c in miniImagenet_dataset:
   print(c)
   Clmean[c,:,:,:]+=t
   
print(Clmean)