If you would like to use nn.BCEWithLogitsLoss (or nn.BCELoss) for the multi-label classification task, you would have to create a multi-hot encoded target.
Assuming label contains the class indices, you could use the following code:
target = torch.zeros(nb_classes)
target[label] = 1.