class_docstr: Returns positive pairs that have distance greater than a margin and negative
  pairs that have distance less than a margin
code: def mine(self, embeddings, labels, ref_emb, ref_labels):
      mat = self.distance(embeddings, ref_emb)
      a1, p, a2, n = lmu.get_all_pairs_indices(labels, ref_labels)
      pos_pair = mat[a1, p]
      neg_pair = mat[a2, n]
      self.set_stats(pos_pair, neg_pair)
      pos_mask = (
          pos_pair < self.pos_margin
          if self.distance.is_inverted
          else pos_pair > self.pos_margin
      )
      neg_mask = (
          neg_pair > self.neg_margin
          if self.distance.is_inverted
          else neg_pair < self.neg_margin
      )
      return a1[pos_mask], p[pos_mask], a2[neg_mask], n[neg_mask]
  
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 PairMarginMiner obj's underlying member method code with example usage: obj.mine(embeddings, labels, ref_emb, ref_labels) and returns: a1,  p,  a2,  n