albanD:

torch.nonzero return a tensor of size nnz x ndim


So it cannot be used easily as index? It seems very intuitive to do something like a[a.nonzero()] but if a is a 3 dimensional tensor this cannot work