nn.BCEWithLogitsLoss
expects logits which are unbound and have values in [-Inf, +inf]
and can be seen as “unnormalized” probabilities (I’m sure @tom or @KFrank can give you a proper mathematical definition), so your output_tensor
won’t match the targets perfectly. Since your output contains probabilities, use nn.BCELoss
instead or low and high values for output_tensor
such as torch.tensor([[-1e10, 1e10]])
with nn.BCEWithLogitsLoss
.
3 Likes