If you are using nn.CrossEntropyLoss (or nn.NLLLoss) for binary classification, each channel of the output will correspond to the logits (or log probabilities) of the class index.
Have a look at the CrossEntropyLoss docs 4 to see the applied formula.
As you can see, the target will be used as an index to get the output logit, which corresponds to this target.
In the case of a binary classification, you can also use nn.BCEWithLogitsLoss, which would then expect an output of [batch_size, 1, h, w] and a target of the same shape.
If you want to get the prediction in terms of class indices, you can call preds = torch.argmax(output, 1) in the former case or use a threshold, if you are using nn.BCEWithLogitsLoss e.g.:
preds = torch.sigmoid(output) > 0.5.