What is the fastest way to compare all the elements of a matrix, with all other elements of the matrix?
for example,
x = torch.randn(5, 5)
y = x.unfold(0, 3, 1).unfold(1, 3, 1)

now if I want to compare every element in these 9 3x3 blocks, with every other 8 elements, without using for loop, then how do I do this?