Logistic regression — MLE in disguise
The 'binary cross-entropy' loss is just the negative log-likelihood of independent Bernoulli observations parameterized by . Training is MLE.
import torch.nn.functional as F
# Logistic regression == NLL of Bernoulli
logits = model(x)
loss = F.binary_cross_entropy_with_logits(logits, y)