Solved by Naruto-Sasuke in post #2 
              
              
                Hi, it is not easy, after hard thinking for one hour, I work out this problem: 
import torch

multihot_batch = torch.tensor([[0,1,0,1], [0,0,0,1], [0,0,1,1]])
#multihot_batch = torch.tensor([[0,1,0,1], [0,0,0,1], [0,0,1,1], [0,0,0,1]])
vnon = (multihot_batch == torch.tensor(1)).nonzero(as_tuple=Fals…