code: def _test_accuracy_calculator_float_custom_comparison_function(
      self, use_numpy
  ):
      def label_comparison_fn(x, y):
          return torch.abs(x - y) < 1
  
      self.assertRaises(
          NotImplementedError,
          lambda: accuracy_calculator.AccuracyCalculator(
              include=("NMI", "AMI"),
              avg_of_avgs=False,
              label_comparison_fn=label_comparison_fn,
              device=TEST_DEVICE,
          ),
      )
  
      AC_global_average = accuracy_calculator.AccuracyCalculator(
          exclude=("NMI", "AMI"),
          avg_of_avgs=False,
          label_comparison_fn=label_comparison_fn,
          device=TEST_DEVICE,
      )
  
      query_labels = [
          0.01,
          0.02,
      ]
  
      reference_labels = [
          10.0,
          0.03,
          0.04,
          0.05,
      ]
  
      if use_numpy:
          query = np.array([0, 3])[:, None]
          reference = np.array([0, 3, 1, 2])[:, None]
          query_labels = np.array(query_labels)
          reference_labels = np.array(reference_labels)
      else:
          query = torch.tensor([0, 3], device=TEST_DEVICE).unsqueeze(1)
          reference = torch.tensor(
              [0, 3, 1, 2], device=TEST_DEVICE
          ).unsqueeze(1)
          query_labels = torch.tensor(
              query_labels,
              device=TEST_DEVICE,
          )
          reference_labels = torch.tensor(
              reference_labels,
              device=TEST_DEVICE,
          )
  
      correct = {
          "precision_at_1": (0 + 1) / 2,
          "r_precision": (2 / 3 + 3 / 3) / 2,
          "mean_average_precision_at_r": ((0 + 1 / 2 + 2 / 3) / 3 + 1)
          / 2,
          "mean_average_precision": (
              (0 + 1 / 2 + 2 / 3 + 3 / 4) / 3 + 1
          )
          / 2,
      }
      acc = AC_global_average.get_accuracy(
          query, query_labels, reference, reference_labels, False
      )
  
      for k in correct:
          self.assertTrue(isclose(acc[k], correct[k]))
  
      # for the query in ref case
      reference_labels = [0.01, 0.02, 10, 0.03]
      reference_labels = (
          np.array(reference_labels)
          if use_numpy
          else torch.tensor(reference_labels, device=TEST_DEVICE)
      )
  
      correct = {
          "precision_at_1": 0.5,
          "r_precision": 0.5,
          "mean_average_precision_at_r": ((0 + 1 / 2) / 2 + (1) / 2)
          / 2,
          "mean_average_precision": (
              (0 + 1 / 2 + 2 / 3) / 2 + (1 + 2 / 3) / 2
          )
          / 2,
      }
      acc = AC_global_average.get_accuracy(
          query, query_labels, reference, reference_labels, True
      )
      for k in correct:
          self.assertTrue(isclose(acc[k], correct[k]))
  
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 5 for calling the TestCalculateAccuraciesAndFaiss obj's underlying member method code with example usage: obj._test_accuracy_calculator_float_custom_comparison_function(use_numpy) and returns: unknown