Yes, you could still use nn.BCEWithLogitsLoss as the criterion.



 NGH:

and if I used this loss function do I need to have Sigmoid as an activate function on the last layer?


No, you would have to pass the raw logits to this loss function.
You could use sigmoid + nn.BCELoss, but this would yield worse numerical stability.