Using BCEWithLogitsLoss for Multi-label problem

I have a dataset which contains images and xml files with associated labels and bounding boxes. Some of the images contain have more than one label.

I have designed a dataloader to extract the annotations from xml files. Based on the dataloader, the output looks like this for 1 batch:

{'boxes': tensor([[[444., 220.,  27.,  65.],
          [468., 220.,  26.,  66.],
          [415., 224.,  20.,  33.]]]), 
'id': tensor([[1., 1., 4.]])}

From my understanding, I would need to use BCEWithLogitsLoss for a multi-label approach.

The issue I am having is how to calculate the loss when there is more than one label. When it is a single label, I use the following approach with a CrossEntropy optimiser:

    for i, data in enumerate(trainloader, 0):
        inputs, labels = data

        outputs = net(inputs)
        loss = criterion(outputs, labels)

Would this approach be correct for multi-labels?