class_docstr: Computes the triplet loss with hard negative and hard positive mining.
  
  The loss encourages the maximum positive distance (between a pair of embeddings
  with the same labels) to be smaller than the minimum negative distance plus the
  margin constant in the mini-batch.
  The loss selects the hardest positive and the hardest negative samples
  within the batch when forming the triplets for computing the loss.
  See: https://arxiv.org/pdf/1703.07737.
  
  We expect labels `y_true` to be provided as 1-D integer `Tensor` with shape
  `[batch_size]` of multi-class integer labels. And embeddings `y_pred` must be
  2-D float `Tensor` of l2 normalized embedding vectors.
  
  Args:
    margin: Float, margin term in the loss definition. Default value is 1.0.
    soft: Boolean, if set, use the soft margin version. Default value is False.
    name: Optional name for the op.
class_docstr_tok: ["Computes","the","triplet","loss","with","hard","negative","and","hard","positive","mining",".","The","loss","encourages","the","maximum","positive","distance","(","between","a","pair","of","embeddings","with","the","same","labels",")","to","be","smaller","than","the","minimum","negative","distance","plus","the","margin","constant","in","the","mini-batch",".","The","loss","selects","the","hardest","positive","and","the","hardest","negative","samples","within","the","batch","when","forming","the","triplets","for","computing","the","loss",".","See",":","https",":","\/\/arxiv.org\/pdf\/1703.07737",".","We","expect","labels","`","y_true","`","to","be","provided","as","1-D","integer","`","Tensor","`","with","shape","`","[","batch_size","]","`","of","multi-class","integer","labels",".","And","embeddings","`","y_pred","`","must","be","2-D","float","`","Tensor","`","of","l2","normalized","embedding","vectors",".","Args",":","margin",":","Float",",","margin","term","in","the","loss","definition",".","Default","value","is","1.0.","soft",":","Boolean",",","if","set",",","use","the","soft","margin","version",".","Default","value","is","False",".","name",":","Optional","name","for","the","op","."]
code: def __init__(
      self,
      margin: FloatTensorLike = 1.0,
      soft: bool = False,
      distance_metric: Union[str, Callable] = "L2",
      name: Optional[str] = None,
      **kwargs,
  ):
      super().__init__(
          triplet_hard_loss,
          name=name,
          reduction=tf.keras.losses.Reduction.NONE,
          margin=margin,
          soft=soft,
          distance_metric=distance_metric,
      )
  
file_path: addons/tensorflow_addons/losses/triplet.py
imports: import tensorflow
  from tensorflow_addons.losses import metric_learning
  from tensorflow_addons.utils.keras_utils import LossFunctionWrapper
  from tensorflow_addons.utils.types import FloatTensorLike, TensorLike
  from typeguard import typechecked
  from typing import Optional, Union, Callable
label_desc: Use image node_id 1 to create a new TripletHardLoss object from inherited base classes: LossFunctionWrapper with example: obj = TripletHardLoss(margin, soft, distance_metric, name)