nn.BCE(WithLogits)Loss would be the alternative and your output and target should then both have the shape of [B, 1, H, W].
I would recommend to use nn.BCEWithLogitsLoss for numerical stability and still remove the last activation layer (sigmoid for nn.BCELoss).