You have different options for a binary classification use case:
- you could use 1 output neuron and [
nn.Sigmoid+nn.BCELoss] - 1 output neuron and [raw logits (no non-linearity for the last layer) +
nn.BCEWithLogitsLoss] - 2 output neurons and [
nn.LogSoftmax+nn.NLLLoss] - 2 output neurons and [raw logits +
nn.CrossEntropyLoss]
So basically you can decide, if you want to use one neuron or two for a binary classification task.