Hello Alex and Doosti!



 Nikronic:

Hi,



 alx:

nn.Linear(num_ftrs, 2))


For binary classification, you need only one logit so, a linear layer that maps its input to a single neuron is adequate. Also, you need to put a threshold on the logit output by linear layer. But an activation layer as the last layer is more rational, something like sigmoid.





 Nikronic:

For case of binary, BCELoss is a good choice.


Just to clarify something, for a binary-classification problem, you
are best off using the logits that come out of a final Linear layer,
with no threshold or Sigmoid activation, and feed them into
BCEWithLogitsLoss.  (Using Sigmoid and BCELoss is less
numerically stable.)
And, as Doosti recommended, your last layer should have a single
output, rather than 2.  Thus:
nn.Linear(num_ftrs, 1))

Best.
K. Frank