# Simple 2 class MLP

**URL:** <https://discuss.pytorch.org/t/simple-2-class-mlp/27297>\
**Category:** vision\
**Created:** [October 15, 2018, 1:21pm UTC](https://discuss.pytorch.org/t/simple-2-class-mlp/27297 "2018-10-15T13:21:38Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 15, 2018, 1:45pm UTC](https://discuss.pytorch.org/t/simple-2-class-mlp/27297/4 "2018-10-15T13:45:18Z")

</div>

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.

---

_[View the full topic](https://discuss.pytorch.org/t/simple-2-class-mlp/27297)._
