Both approaches are the same.
In fact nn.CrossEntropyLoss just uses nn.LogSoftmax() + nn.NLLLoss() internally.
Here 189 is the line of code.
For a binary classification you could use nn.CrossEntropyLoss() with a logit output of shape [batch_size, 2] or nn.BCELoss() with a nn.Sigmoid() in the last layer.