Solved by b02202050 in post #9 
              
              
                Sorry, I don’t know if the function you need exists. But I can show you what I will do: 
coords_A = coords.view(coords.shape[0], 1, 3).repeat(1, coords.shape[0], 1)
coords_B = coords.view(1, coords.shape[0], 3).repeat(coords.shape[0], 1, 1)
coords_confusion = torch.stack((coords_A, coords_B), dim=2)…