Hello,
I think shape of output of the network is depending on which loss function employed.
In binary classification, you can use both CELoss and BCELoss.
For CELoss, the shape of the output should be [batch_size, nb_classes, H, W] then produce a probability map by softmax.
For BCELoss, the shape should be [batch_size, H, W] which is the same to label, and it should incorperate with sigmoid.
Note: CELoss has contain logsoftmax, so you could only pass the model output and label.
BCELossWithLogits = BCELoss+sigmoid
for more details 4