Thanks for the info. That’s a lot for a piano 
It looks like your target might be one-hot encoded, since its dimension is currently [batch_size, nb_classes], which is wrong using nn.CrossentropyLoss.
However, let’s stick to your use case and use a multi-label approach.
For this we would need “multi-hot” encoded targets, i.e. for each sample a tensor of this form [0., 0., 1., 0., 1., 0., ...].
Here is a dummy example:

batch_size = 10
nb_classes = 5
output = torch.randn(batch_size, nb_classes, requires_grad=True)
target = torch.empty(batch_size, nb_classes).random_(2)
criterion = nn.BCEWithLogitsLoss()
loss = criterion(output, target)
loss.backward()

Basically, your model output and target should have the same shape in this case.
If your output contains raw logits, use nn.BCEWithLogitsLoss.
Alternatively, you could use torch.sigmoid on the output and use nn.BCELoss as the criterion.