Squared distance computation in PyTorch – Avoid for loop
I have a code where a 2D grid of size (20, 20) when flattened (400) needs to have distance computed from all other indices on the 2D grid. Currently, I am using a for loop to store it.
I have a code where a 2D grid of size (20, 20) when flattened (400) needs to have distance computed from all other indices on the 2D grid. Currently, I am using a for loop to store it.