tfa.losses.triplet_semihard_loss

View source on GitHub

Computes the triplet loss with semi-hard negative mining.

Aliases:

tfa.losses.triplet_semihard_loss(
    y_true,
    y_pred,
    margin=1.0
)

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.