code: def test_remove_self_comparisons(self):
      labels = torch.tensor([0, 0, 1])
      ref_labels = torch.tensor([1, 1, 0, 0])
  
      for do_reverse in [False, True]:
          if do_reverse:
              all_labels = torch.cat([ref_labels, labels])
              curr_batch_idx = torch.arange(4, 7)
              correct_a1 = torch.tensor([0, 0, 0, 1, 1, 1, 2, 2])
              correct_p = torch.tensor([2, 3, 5, 2, 3, 4, 0, 1])
          else:
              all_labels = torch.cat([labels, ref_labels])
              curr_batch_idx = torch.arange(3)
              correct_a1 = torch.tensor([0, 0, 0, 1, 1, 1, 2, 2])
              correct_p = torch.tensor([1, 5, 6, 0, 5, 6, 3, 4])
  
          indices_tuple = lmu.get_all_pairs_indices(labels, all_labels)
          ref_size = len(all_labels)
          indices_tuple = lmu.remove_self_comparisons(
              indices_tuple, curr_batch_idx, ref_size
          )
          a1, p, a2, n = indices_tuple
          self.assertTrue(torch.equal(a1, correct_a1))
          self.assertTrue(torch.equal(p, correct_p))
  
file_path: pytorch-metric-learning/tests/utils/test_loss_and_miner_utils.py
imports: import unittest
  import torch
  from pytorch_metric_learning.utils import loss_and_miner_utils
  from ..None import TEST_DEVICE, TEST_DTYPES
label_desc: Use image node_id 6 for calling the TestLossAndMinerUtils obj's underlying member method code with example usage: obj.test_remove_self_comparisons() without return types