BCEWithLogitsLoss
class torch.nn.BCEWithLogitsLoss(weight=None, size_average=None, reduce=None, reduction='mean', pos_weight=None)
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 layer, we take advantage of the log-sum-exp
   trick for numerical stability.
The unreduced (i.e. with "reduction" set to "'none'") loss can be
   described as:
  \ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad l_n = - w_n
  \left[ y_n \cdot \log \sigma(x_n) + (1 - y_n) \cdot \log (1 -
  \sigma(x_n)) \right],

where N is the batch size. If "reduction" is not "'none'" (default
   "'mean'"), then
  \ell(x, y) = \begin{cases}     \operatorname{mean}(L), &
  \text{if reduction} = \text{`mean';}\\
  \operatorname{sum}(L),  & \text{if reduction} = \text{`sum'.}
  \end{cases}
