Make sure you pass the mean and std values as 1-dimensional tensors, e.g.:
mean = torch.tensor([0.5, 0.5, 0.5])

Based on the error, it looks like you are trying to pass them as 0-dim tensors:
mean = torch.tensor(0.5)