Normalising a tensor

I have a tensor with shape [10000,1,1024]. 10000 is the number of samples I have. I have to normalise each sample and i have no problem finding the maximum value by which I should divide each sample. i have problems understanding how to divide the 1024 values in each sample by that value and obtain a new tensor with shape [10000,1,1024] and normalised samples. Can anyone help?

I think this doc would help.

Tensor are treated in a element-wise way, so if you code

A = torch.torch.randn(10000, 1, 1024)

B = A / 255

print(B)
print(A)

Even though, there is some specific documentation about lib torchvision.transforms that include normalize
https://pytorch.org/docs/stable/_modules/torchvision/transforms/transforms.html#Normalize

I hope this helps :slight_smile: