code: def test_get_lone_query_labels(self):
      query_labels = torch.tensor(
          [0, 1, 2, 3, 4, 5, 6], device=TEST_DEVICE
      )
      reference_labels = torch.tensor(
          [0, 0, 0, 1, 2, 2, 3, 4, 5], device=TEST_DEVICE
      )
      label_counts = accuracy_calculator.get_label_match_counts(
          query_labels,
          reference_labels,
          accuracy_calculator.EQUALITY,
      )
  
      for same_source, correct in [
          (True, torch.tensor([1, 3, 4, 5, 6], device=TEST_DEVICE)),
          (False, torch.tensor([6], device=TEST_DEVICE)),
      ]:
          (
              lone_query_labels,
              _,
          ) = accuracy_calculator.get_lone_query_labels(
              query_labels,
              label_counts,
              same_source,
              accuracy_calculator.EQUALITY,
          )
          self.assertTrue(torch.all(lone_query_labels == correct))
  
imports: import itertools
  import logging
  import unittest
  import numpy
  import torch
  from pytorch_metric_learning.distances import LpDistance
  from pytorch_metric_learning.utils import accuracy_calculator
  from pytorch_metric_learning.utils.common_functions import LOGGER
  from pytorch_metric_learning.utils.inference import CustomKNN, FaissKMeans, FaissKNN
  from ..None import TEST_DEVICE
label_desc: Use image node_id 9 for calling the TestCalculateAccuracies obj's underlying member method code with example usage: obj.test_get_lone_query_labels() without return types