class_docstr: Returns triplets that violate the margin
  Args:
      margin
      type_of_triplets: options are "all", "hard", or "semihard".
              "all" means all triplets that violate the margin
              "hard" is a subset of "all", but the negative is closer to the anchor than the positive
              "semihard" is a subset of "all", but the negative is further from the anchor than the positive
          "easy" is all triplets that are not in "all"
code: def mine(self, embeddings, labels, ref_emb, ref_labels):
      (
          anchor_idx,
          positive_idx,
          negative_idx,
      ) = lmu.get_all_triplets_indices(labels, ref_labels)
      mat = self.distance(embeddings, ref_emb)
      ap_dist = mat[anchor_idx, positive_idx]
      an_dist = mat[anchor_idx, negative_idx]
      triplet_margin = (
          ap_dist - an_dist
          if self.distance.is_inverted
          else an_dist - ap_dist
      )
  
      self.set_stats(ap_dist, an_dist, triplet_margin)
  
      if self.type_of_triplets == "easy":
          threshold_condition = triplet_margin > self.margin
      else:
          threshold_condition = triplet_margin <= self.margin
          if self.type_of_triplets == "hard":
              threshold_condition &= triplet_margin <= 0
          elif self.type_of_triplets == "semihard":
              threshold_condition &= triplet_margin > 0
  
      return (
          anchor_idx[threshold_condition],
          positive_idx[threshold_condition],
          negative_idx[threshold_condition],
      )
  
imports: import torch
  from ..utils import loss_and_miner_utils
  from .base_miner import BaseMiner
label_desc: Use image node_id 2 for calling the TripletMarginMiner obj's underlying member method code with example usage: obj.mine(embeddings, labels, ref_emb, ref_labels) and returns: anchor_idx,  positive_idx,  negative_idx