code: def test_custom_knn(self):
      LOGGER.setLevel(logging.CRITICAL)
      torch.manual_seed(6920)
      for dataset_size in [200, 1000]:
          for batch_size in [None, 32, 33, 2000]:
              for ref_includes_query in [False, True]:
                  for k in [None, 1, 2, 10, 100]:
                      fn1 = CustomKNN(
                          LpDistance(
                              normalize_embeddings=False, power=2
                          ),
                          batch_size,
                      )
                      fn2 = FaissKNN()
                      AC1 = accuracy_calculator.AccuracyCalculator(
                          k=k, knn_func=fn1, exclude=("AMI", "NMI")
                      )
                      AC2 = accuracy_calculator.AccuracyCalculator(
                          k=k, knn_func=fn2, exclude=("AMI", "NMI")
                      )
                      embeddings = torch.randn(dataset_size, 32)
                      labels = torch.randint(
                          0, 10, size=(dataset_size,)
                      )
                      acc1 = AC1.get_accuracy(
                          embeddings,
                          labels,
                          embeddings,
                          labels,
                          ref_includes_query,
                      )
                      acc2 = AC2.get_accuracy(
                          embeddings,
                          labels,
                          embeddings,
                          labels,
                          ref_includes_query,
                      )
  
                      for acc_name, v in acc1.items():
                          self.assertTrue(
                              np.isclose(v, acc2[acc_name], rtol=1e-3)
                          )
      LOGGER.setLevel(logging.INFO)
  
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 1 for calling the TestCalculateAccuraciesCustomKNN obj's underlying member method code with example usage: obj.test_custom_knn() without return types