See the followings.

http://pytorch.org/docs/master/nn.html?highlight=logitsloss#torch.nn.BCEWithLogitsLoss 192
http://pytorch.org/docs/master/nn.html?highlight=binary#torch.nn.functional.binary_cross_entropy_with_logits 88