For multi-class classification you would usually just use nn.CrossEntropyLoss 1.5k, and I don’t think you’ll end up with the same result, as you are calling torch.sigmoid on each prediction.
For multi-label classification, you might use nn.BCELoss with hot-encoded targets and won’t need a for loop.
Could you explain your use case a bit as I’m currently not sure to understand it properly?