I am quite new to pytorch and I am looking to apply L2 normalisation to two types of tensors, but I am npot totally sure what I am doing is correct:
[1]. type 1 (in the forward function) has shape torch.Size([2, 128]) and I would like to normalise each tensor (L2 norm).
for this case, I do:
F.normalize(tensor_variable, p=2, dim=1)
Is this the correct way to do it? is there any check I can perform to know that the vectors have been L2 normed?
[2] type2 has shape ([128]): for this I just do:
F.normalize(tensor_variable, p=2, dim=0)
Is this the correct way to go about it?
I am not able to find the doc link to this F.normalize function and I am having to take a guess at the dimension