# Loss Functions — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# Loss Functions

`binary_cross_entropy`(logits, targets[, ...]) | Computes the binary cross entropy loss.
`cross_entropy`(logits, targets[, weights, ...]) | Computes the cross entropy loss.
`kl_div_loss`(inputs, targets[, axis, reduction]) | Computes the Kullback-Leibler divergence loss.
`l1_loss`(predictions, targets[, reduction]) | Computes the L1 loss.
`mse_loss`(predictions, targets[, reduction]) | Computes the mean squared error loss.
`nll_loss`(inputs, targets[, axis, reduction]) | Computes the negative log likelihood loss.
`smooth_l1_loss`(predictions, targets[, beta, ...]) | Computes the smooth L1 loss.
`triplet_loss`(anchors, positives, negatives) | Computes the triplet loss for a set of anchor, positive, and negative samples.
`hinge_loss`(inputs, targets[, reduction]) | Computes the hinge loss between inputs and targets.
`huber_loss`(inputs, targets[, delta, reduction]) | Computes the Huber loss between inputs and targets.
`log_cosh_loss`(inputs, targets[, reduction]) | Computes the log cosh loss between inputs and targets.