code: def _test_accuracy_calculator_and_faiss_avg_of_avgs(self, use_numpy):
      AC_global_average = accuracy_calculator.AccuracyCalculator(
          avg_of_avgs=False, device=TEST_DEVICE
      )
      AC_per_class_average = accuracy_calculator.AccuracyCalculator(
          avg_of_avgs=True, device=TEST_DEVICE
      )
  
      query_labels = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
      reference_labels = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  
      if use_numpy:
          query = np.arange(10)[:, None]
          reference = np.arange(10)[:, None]
          query_labels = np.array(query_labels)
          reference_labels = np.array(reference_labels)
      else:
          query = torch.arange(10, device=TEST_DEVICE).unsqueeze(1)
          reference = torch.arange(10, device=TEST_DEVICE).unsqueeze(1)
          query_labels = torch.tensor(query_labels, device=TEST_DEVICE)
          reference_labels = torch.tensor(
              reference_labels, device=TEST_DEVICE
          )
  
      query[-1] = 100
      reference[0] = -100
  
      acc = AC_global_average.get_accuracy(
          query, query_labels, reference, reference_labels, False
      )
      self.assertTrue(isclose(acc["precision_at_1"], 0.9))
      self.assertTrue(isclose(acc["r_precision"], 0.9))
      self.assertTrue(isclose(acc["mean_average_precision_at_r"], 0.9))
      self.assertTrue(
          isclose(acc["mean_average_precision"], 0.9 + 0.01)
      )
  
      acc = AC_per_class_average.get_accuracy(
          query, query_labels, reference, reference_labels, False
      )
      self.assertTrue(isclose(acc["precision_at_1"], 0.5))
      self.assertTrue(isclose(acc["r_precision"], 0.5))
      self.assertTrue(isclose(acc["mean_average_precision_at_r"], 0.5))
      self.assertTrue(
          isclose(acc["mean_average_precision"], (1 + 0.1) / 2)
      )
  
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 3 for calling the TestCalculateAccuraciesAndFaiss obj's underlying member method code with example usage: obj._test_accuracy_calculator_and_faiss_avg_of_avgs(use_numpy) without return types