Hi all, my problem is a binary class classification. when I’m training my model with BCELoss and sigmoid. I’m getting nan in second epoch right away. However, when I changed my loss to Crossentropy, the model is not outputting any nan’s. Can anyone explain what’s going on. if I should only be using BCELoss, can you suggest If I can find out what’s causing nan’s.
Thank you
Remove the sigmoid
and use nn.BCEWithLogitsLoss
for better numerical stability and check if you would still see the NaN outputs.