code: def mine(self, embeddings, labels, ref_emb, ref_labels):
      mat = self.distance(embeddings, ref_emb)
      a1_idx, p_idx, a2_idx, n_idx = lmu.get_all_pairs_indices(
          labels, ref_labels
      )
      a = torch.arange(mat.size(0), device=mat.device)
  
      if (
          self.pos_strategy == self.SEMIHARD
          and self.neg_strategy != self.ALL
      ):
          (
              negative_dists,
              negative_indices,
          ), a2n_keep = self.get_negatives(mat, a2_idx, n_idx)
          (
              positive_dists,
              positive_indices,
          ), a1p_keep = self.get_positives(
              mat, a1_idx, p_idx, negative_dists
          )
      elif (
          self.neg_strategy == self.SEMIHARD
          and self.pos_strategy != self.ALL
      ):
          (
              positive_dists,
              positive_indices,
          ), a1p_keep = self.get_positives(mat, a1_idx, p_idx)
          (
              negative_dists,
              negative_indices,
          ), a2n_keep = self.get_negatives(
              mat, a2_idx, n_idx, positive_dists
          )
      else:
          if self.pos_strategy != self.ALL:
              (
                  positive_dists,
                  positive_indices,
              ), a1p_keep = self.get_positives(mat, a1_idx, p_idx)
          if self.neg_strategy != self.ALL:
              (
                  negative_dists,
                  negative_indices,
              ), a2n_keep = self.get_negatives(mat, a2_idx, n_idx)
  
      if self.ALL not in [self.pos_strategy, self.neg_strategy]:
          a_keep_idx = torch.where(a1p_keep & a2n_keep)
          self.set_stats(
              positive_dists[a_keep_idx], negative_dists[a_keep_idx]
          )
          a = a[a_keep_idx]
          p = positive_indices[a_keep_idx]
          n = negative_indices[a_keep_idx]
          return a, p, a, n
      elif (
          self.pos_strategy == self.ALL
          and self.neg_strategy != self.ALL
      ):
          self.set_stats(mat[a1_idx, p_idx], negative_dists[a2n_keep])
          a2 = a[a2n_keep]
          n = negative_indices[a2n_keep]
          return a1_idx, p_idx, a2, n
      elif (
          self.pos_strategy != self.ALL
          and self.neg_strategy == self.ALL
      ):
          self.set_stats(positive_dists[a1p_keep], mat[a2_idx, n_idx])
          a1 = a[a1p_keep]
          p = positive_indices[a1p_keep]
          return a1, p, a2_idx, n_idx
      else:
          self.set_stats(mat[a1_idx, p_idx], mat[a2_idx, n_idx])
          return a1_idx, p_idx, a2_idx, n_idx
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/miners/batch_easy_hard_miner.py
imports: import torch
  from ..utils import common_functions
  from ..utils import loss_and_miner_utils
  from .base_miner import BaseMiner
label_desc: Use image node_id 2 for calling the BatchEasyHardMiner obj's underlying member method code with example usage: obj.mine(embeddings, labels, ref_emb, ref_labels) and returns: a,  p,  a,  n, a1_idx,  p_idx,  a2,  n, a1,  p,  a2_idx,  n_idx, a1_idx,  p_idx,  a2_idx,  n_idx