How to Tensorize loss of multiple 3D Keypoints
I have a tensor of ground truth values of 3D points of G=[18000x3], and an output from my network of the same size O=[18000x3].

I need to compute a loss so that I basically have the square root of the distance between each 3D point, summed over all keypoints and normalized over 18000. How do I write this efficiently?

Just write the expression you propose using the vectorized operations provided by PyTorch. In this case

loss = (O - G).pow(2).sum(axis=1).sqrt().mean()


Check out pow, sum, sqrt and mean.
