Hello,
I have a tensor with shape Nx2 that stores coordinates (x,y). I want to compute the x-distance and the y-distance between all coordinates. So if I have N coordinates, I will have N*N distances in the end. I could easily do this with two loops or with python’s itertools. However, it would be much faster to do it with PyTorch on the GPU.
Is there an easy possibility to combine each element in a tensor with every other element in this tensor?
The number of coordinates will be < 100, so in the worst case there will be 10.000 distances to be computed. So it should not be a problem with GPU memory.
Best,
Simon