How to get the index of multidimensional array efficiently?

How to get the index of multidimensional array efficiently? For example, I want to know what are the multidimensional indices of values greater than 5.

torch.nonzero(x>5) :wink:

1 Like