# Module: tf.contrib.losses

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/losses/__init__.py) |

Ops for building neural network losses.

See [Contrib Losses](https://tensorflow.org/api_guides/python/contrib.losses).

## Modules

[`metric_learning`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning) module: Ops for building neural network losses.

## Functions

[`absolute_difference(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/absolute_difference): Adds an Absolute Difference loss to the training procedure. (deprecated)

[`add_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/add_loss): Adds a externally defined loss to the collection of losses. (deprecated)

[`compute_weighted_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/compute_weighted_loss): Computes the weighted loss. (deprecated)

[`cosine_distance(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/cosine_distance): Adds a cosine-distance loss to the training procedure. (deprecated arguments) (deprecated)

[`get_losses(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/get_losses): Gets the list of losses from the loss_collection. (deprecated)

[`get_regularization_losses(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/get_regularization_losses): Gets the regularization losses. (deprecated)

[`get_total_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/get_total_loss): Returns a tensor whose value represents the total loss. (deprecated)

[`hinge_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/hinge_loss): Method that returns the loss tensor for hinge loss. (deprecated)

[`log_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/log_loss): Adds a Log Loss term to the training procedure. (deprecated)

[`mean_pairwise_squared_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/mean_pairwise_squared_error): Adds a pairwise-errors-squared loss to the training procedure. (deprecated)

[`mean_squared_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/mean_squared_error): Adds a Sum-of-Squares loss to the training procedure. (deprecated)

[`sigmoid_cross_entropy(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/sigmoid_cross_entropy): Creates a cross-entropy loss using tf.nn.sigmoid_cross_entropy_with_logits. (deprecated)

[`softmax_cross_entropy(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/softmax_cross_entropy): Creates a cross-entropy loss using tf.nn.softmax_cross_entropy_with_logits. (deprecated)

[`sparse_softmax_cross_entropy(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/sparse_softmax_cross_entropy): Cross-entropy loss using [`tf.nn.sparse_softmax_cross_entropy_with_logits`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/sparse_softmax_cross_entropy_with_logits). (deprecated)