The answer you gave is not correct .
a = torch.rand(5,5)
b = b = torch.LongTensor([4,3,2,1,0])
a[b, :][:, b]
Traceback (most recent call last):
File “”, line 1, in 
TypeError: indexing a tensor with an object of type LongTensor. The only supported types are integers, slices, numpy scalars and torch.LongTensor or torch.ByteTe