Hi John!



 John_J_Watson:

Is this the correct way to do it?


Yes, your use of normalize() is correct.


is there any check I can perform to know that the vectors have been L2 normed?


Just compute the (square of the) norm:
(torch.nn.functional.normalize (tensor_variable, p = 2, dim = 1)**2).sum (dim = 1)

and check that you get 1 for each row of tensor_input.


I am not able to find the doc link to this F.normalize function


You can find the documentation here: normalize 72.
Best.
K. Frank