You could try to transform your target to a multi-hot encoded tensor, i.e. each active class has a 1 while inactive classes have a 0, and use nn.BCEWithLogitsLoss as your criterion.
Your target would thus have the same shape as your model output.
This worked pretty well in the past for me.