Solved by Eta_C in post #4 
              
              
                So target is a boolean tensor. I think, maybe… 
output = torch.randn(64, 134)
target = torch.randn(64, 134) > 0.5  # multi hot

def accuracy(output, target, topk=(1,)):
    maxk = max(topk)
    batch_size = target.size(0)

    _, pred = output.topk(maxk, dim=1, largest=True, sorted=True)
    print(p…