image_arr = []

for i in range(len(train_dataset)):
    image_arr.append(to_tensor(train_dataset[i]['image']))
                     
mean = torch.mean(torch.stack(image_arr, dim=0), dim=(0, 2, 3))
std = torch.std(torch.stack(image_arr, dim=0), dim=(0, 2, 3))

print(mean.shape)
print("mean is {} and std is {}".format(mean, std))

worked
and answer is:
torch.Size([3])
mean is tensor([0.3809, 0.3810, 0.3810]) and std is tensor([0.1127, 0.1129, 0.1130])