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.
docstr: Args:
      inputs (torch.Tensor): feature matrix with shape
          (batch_size, feat_dim).
      targets (torch.LongTensor): ground truth labels with shape
          (num_classes).
  
  Returns:
      torch.Tensor: triplet loss.
code: def forward(
      self, inputs: torch.Tensor, targets: torch.LongTensor
  ) -> torch.Tensor:
      """
      Args:
          inputs (torch.Tensor): feature matrix with shape
              (batch_size, feat_dim).
          targets (torch.LongTensor): ground truth labels with shape
              (num_classes).
  
      Returns:
          torch.Tensor: triplet loss.
      """
      if self.hard_mining:
          return self.hard_mining_triplet_loss_forward(inputs, targets)
      else:
          raise NotImplementedError()
  
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 3 for calling the TripletLoss obj's underlying member method code with example usage: obj.forward(inputs, targets) and returns: self