# Calculating the loss
loss_val = nn.CrossEntropyLoss()(out, y)         # (1)
loss_val1 = nn.BCEWithLogitsLoss()(out, y1)   # (2)

If you’re referring to these, you definitely shouldn’t trust (1) because it doesn’t give you the behavior you want. (2) works, but has an extra term that may or may not affect your training.