Rate this Page

torch.nn.functional.triplet_margin_loss#

torch.nn.functional.triplet_margin_loss(anchor, positive, negative, margin=1.0, p=2, eps=1e-06, swap=False, size_average=None, reduce=None, reduction='mean')[source]#

Compute the triplet loss between given input tensors and a margin greater than 0.

See TripletMarginLoss for details.

Return type

Tensor