Loss Functions#

binary_cross_entropy(inputs, targets[, ...])

Computes the binary cross entropy loss.

cosine_similarity_loss(x1, x2[, axis, eps, ...])

Computes the cosine similarity between the two inputs.

cross_entropy(logits, targets[, weights, ...])

Computes the cross entropy loss.

gaussian_nll_loss(inputs, targets, vars[, ...])

Computes the negative log likelihood loss for a Gaussian distribution.

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.

kl_div_loss(inputs, targets[, axis, reduction])

Computes the Kullback-Leibler divergence loss.

l1_loss(predictions, targets[, reduction])

Computes the L1 loss.

log_cosh_loss(inputs, targets[, reduction])

Computes the log cosh loss between inputs and targets.

margin_ranking_loss(inputs1, inputs2, targets)

Calculate the margin ranking loss that loss given inputs \(x_1\), \(x_2\) and a label \(y\) (containing 1 or -1).

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.