# tensorplay.nn.functional.triplet_margin_with_distance_loss

Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.functional.triplet_margin_with_distance_loss.html

# tensorplay.nn.functional.triplet_margin_with_distance_loss

tensorplay.nn.functional.triplet_margin_with_distance_loss(anchor: TensorBase, positive: TensorBase, negative: TensorBase, *, distance_function=None, margin: [float](https://docs.python.org/3/library/functions.html#float) = 1.0, swap: [bool](https://docs.python.org/3/library/functions.html#bool) = False, reduction: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'mean') &#x2192; TensorBase[[source]](../_modules/tensorplay/nn/functional.html#triplet_margin_with_distance_loss)

Compute the triplet margin loss using a custom distance function.

See TripletMarginWithDistanceLoss for details.
