TripletMarginLossΒΆ
Creates a criterion that measures the triplet loss.
Abstract Signature:
TripletMarginLoss(anchor: Tensor, positive: Tensor, negative: Tensor, margin: float = 1.0, p: float = 2.0, eps: float = 1e-06, swap: bool = False)
JAX (Core)
API:
βStrategy: Plugin (triplet_loss_impl)
TensorFlow
API:
tf.keras.losses.triplet_semihard_lossStrategy: Macro 'tf.maximum(tf.norm({anchor}-{positive}, ord={p}) - tf.norm({anchor}-{negative}, ord={p}) + {margin}, 0)'