hello, thanks for your reply,
I saw pdist, but it work a bit differently than what I want to do, I want to compare each element with each other element, but not row-wise, because I want to change the value of element, if I use row wise comparison, then I will have to change the value of all the elements in a row, currently I use two for loops, to go through tensor, and compare values, and update values.
Plus one more problem is that if a value in any one of the 9 3x3 blocks gets updated, then I want to store the updated value in my output tensor.