Based on the output it seems you are working on a multi-class classification (i.e. each sample has one target only), so you could directly use nn.CrossEntropyLoss.
On the other hand, if some samples have zero, one, or more active targets you would be working on a multi-label classification, could use nn.BCEWithLogitsLoss and would then multi-hot encode the target.