If you have binary classification (not (dog or cat), but (dog or others) ), i think softmax is not logical way. This post may help you. There are binary classification loss functions such as torch.nn.BCEWithLogitsLoss 151.

  
    
    
    Is it ok to use nn.CrossEntropyLoss() even for binary classification? 
  
  
    I am training a binary classifier, however I have a softmax layer as the last layer, thus is it ok if I use nn.CrossEntropyLoss() as objective function instead of Binary Cross entropy loss? are there any difference?