I’m a little confused by your statement.



 Luca_Pamparana:

I am getting the indexes with zero values


By using torch.nonzero you get the indices where the values are not zero. So, If you want to get the indices where the values of your array are non-zero in all of the three dimensions, namely 2, 3 and 4, then you could do array[:, 2:5].prod(1).nonzero().