For a binary classification you could either use your setup with two output channels and nn.CrossEntropyLoss, or alternatively you could output a single channel and use nn.BCEWithLogitsLoss.
For former is used for a multi-class classification, while the latter approach is used for a binary or multi-label classification.