# Module: tf.contrib.losses.metric_learning

<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/python/metric_learning/__init__.py) |

Ops for building neural network losses.

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

## Functions

[`cluster_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/cluster_loss): Computes the clustering loss.

[`contrastive_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/contrastive_loss): Computes the contrastive loss.

[`lifted_struct_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/lifted_struct_loss): Computes the lifted structured loss.

[`npairs_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/npairs_loss): Computes the npairs loss.

[`npairs_loss_multilabel(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/npairs_loss_multilabel): Computes the npairs loss with multilabel data.

[`triplet_semihard_loss(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/losses/metric_learning/triplet_semihard_loss): Computes the triplet loss with semi-hard negative mining.