tfa.losses.triplet_hard_loss

View source on GitHub

Computes the triplet loss with hard negative and hard positive mining.

Args:

  • y_true: 1-D integer Tensor with shape [batch_size] of multiclass integer labels.
  • y_pred: 2-D float Tensor of embedding vectors. Embeddings should be l2 normalized.
  • margin: Float, margin term in the loss definition.
  • soft: Boolean, if set, use the soft margin version.