eazygrad.bce_with_logits_loss

eazygrad.bce_with_logits_loss(logits: _Tensor, target: _Tensor) _Tensor[source]

Compute binary cross-entropy loss from unnormalized logits.

Parameters:
  • logits (_Tensor) – Input logits.

  • target (_Tensor) – Target tensor with values typically in [0, 1] and the same shape as logits.

Returns:

_Tensor – Scalar loss tensor.

Notes

This implementation uses a numerically stable formulation and internally averages the per-element loss.