class_docstr: Computes the triplet loss with semi-hard negative mining.
  
  The loss encourages the positive distances (between a pair of embeddings
  with the same labels) to be smaller than the minimum negative distance
  among which are at least greater than the positive distance plus the
  margin constant (called semi-hard negative) in the mini-batch.
  If no such negative exists, uses the largest negative distance instead.
  See: https://arxiv.org/abs/1503.03832.
  
  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.
    name: Optional name for the op.
class_docstr_tok: ["Computes","the","triplet","loss","with","semi-hard","negative","mining",".","The","loss","encourages","the","positive","distances","(","between","a","pair","of","embeddings","with","the","same","labels",")","to","be","smaller","than","the","minimum","negative","distance","among","which","are","at","least","greater","than","the","positive","distance","plus","the","margin","constant","(","called","semi-hard","negative",")","in","the","mini-batch",".","If","no","such","negative","exists",",","uses","the","largest","negative","distance","instead",".","See",":","https",":","\/\/arxiv.org\/abs\/1503.03832",".","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.","name",":","Optional","name","for","the","op","."]
code: def __init__(
      self,
      margin: FloatTensorLike = 1.0,
      distance_metric: Union[str, Callable] = "L2",
      name: Optional[str] = None,
      **kwargs,
  ):
      super().__init__(
          triplet_semihard_loss,
          name=name,
          reduction=tf.keras.losses.Reduction.NONE,
          margin=margin,
          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 TripletSemiHardLoss object from inherited base classes: LossFunctionWrapper with example: obj = TripletSemiHardLoss(margin, distance_metric, name)