class_docstr: Triplet loss with hard positive/negative mining.
  
  Reference:
      Hermans et al. In Defense of the Triplet Loss for
          Person Re-Identification. arXiv:1703.07737.
  Imported from `<https://github.com/KaiyangZhou/deep-person-reid/blob/
      master/torchreid/losses/hard_mine_triplet_loss.py>`_.
  Args:
      margin (float, optional): Margin for triplet loss. Defaults to 0.3.
      loss_weight (float, optional): Weight of the loss. Defaults to 1.0.
      hard_mining (bool, optional): Whether to perform hard mining.
          Defaults to True.
code: def __init__(
      self,
      margin: float = 0.3,
      loss_weight: float = 1.0,
      hard_mining=True,
  ):
      super(TripletLoss, self).__init__()
      self.margin = margin
      self.ranking_loss = nn.MarginRankingLoss(margin=margin)
      self.loss_weight = loss_weight
      self.hard_mining = hard_mining
  
file_path: mmdetection/mmdet/models/losses/triplet_loss.py
imports: import torch
  import torch.nn
  from mmengine.model import BaseModule
  from mmdet.registry import MODELS
label_desc: Use image node_id 1 to create a new TripletLoss object from inherited base classes: BaseModule with example: obj = TripletLoss(margin, loss_weight, hard_mining)