The new labels look like: [0, 1, 1, 0, 0, 1, 0].
The original loss function: torch.nn.CrossEntropyLoss()
The calculation segment:
pred = model(images.to(device)) loss = loss_function(pred, labels.to(device))
(How to use torch.nn.BCEWithLogitsLoss to replace that?
I have gotten some answers from GPTs and Google without executable details.
If you have your labels in that format already, you can just swap the loss function.