Combine pytorch nonzero calls

I have a Pytorch tensor and currently I am getting the indexes with zero values as follows:

non_zero_ind = (torch.nonzero(array[:, 4]))

Now, I also need to get these indexes if the values at indices 2, 3 are also zeros. So something like:

non_zero_ind = (torch.nonzero(array[:, 4])) or (torch.nonzero(array[:, 2])) or (torch.nonzero(array[:, 3]))

How can one perform this quite of query on the pytorch tensor?

I’m a little confused by your statement.

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().