Is BCEWithLogitsLoss obtained as weighted BCE loss?

hi everyone
can we obtain the BCEWithLogitsLoss as weighting
or it just BCE loss function combined with a sigmoid activation function?

Hi M!

No. They take different inputs – logits vs. probabilities – and you can’t
compensate for that difference with weighting.

Mathematically yes. In its numerical implementation, BCEWithLogitsLoss uses
the (mathematically-equivalent) logsigmoid() instead of log (sigmoid()) for
reasons of numerical stability.

Best.

K. Frank