I’m not sure if you would like to apply this normalization of each sample or somewhere inside the model.
In the former case, use torchvision.transforms.Normalize and set the mean to zeros.
In the latter case, just divide by torch.std(x) (and specify the dimensions if needed).