BCELoss vs BCEWithLogitsLoss - PyTorch Forums
discuss.pytorch.org › t › bceloss-vsJan 02, 2019 · I thought BCELoss needs to receive the outputs of Sigmoid activation as its input, but the other-one BCEWithLogitsLoss will need the logits as inputs instead of outputs of Sigmoid, since it will apply sigmoid internally. Although, the example in the docs do not apply Sigmoid function prior to BCELoss: ### Example from pytorch-docs: >>> m = nn ...
BCEWithLogitsLoss — PyTorch 1.10.1 documentation
pytorch.org › torchBCEWithLogitsLoss. class torch.nn.BCEWithLogitsLoss(weight=None, size_average=None, reduce=None, reduction='mean', pos_weight=None) [source] This loss combines a Sigmoid layer and the BCELoss in one single class. This version is more numerically stable than using a plain Sigmoid followed by a BCELoss as, by combining the operations into one ...