code: def do_test(self, factory_string):
      ds = datasets.SyntheticDataset(32, 2000, 4000, 1000)
      k = 10
      index = faiss.index_factory(ds.d, factory_string)
      index.train(ds.get_train())
      index.add(ds.get_database())
      index.nprobe = 5
      Dref, Iref = index.search(ds.get_queries(), k)
      res = faiss.StandardGpuResources()
  
      def pairwise_distances(xq, xb, metric=faiss.METRIC_L2):
          return faiss.pairwise_distance_gpu(
              res, xq, xb, metric=faiss.METRIC_L2
          )
  
      def knn_function(xq, xb, k, metric=faiss.METRIC_L2):
          return faiss.knn_gpu(res, xq, xb, k, metric=faiss.METRIC_L2)
  
      for method in "pairwise_distances", "knn_function":
          Dnew, Inew = big_batch_search.big_batch_search(
              index,
              ds.get_queries(),
              k,
              method=method,
              pairwise_distances=pairwise_distances,
              knn=knn_function,
          )
          self.assertLess((Inew != Iref).sum() / Iref.size, 1e-4)
          np.testing.assert_almost_equal(Dnew, Dref, decimal=4)
  
imports: import unittest
  import faiss
  import numpy
  from common_faiss_tests import get_dataset_2
  from faiss.contrib import datasets, evaluation, big_batch_search
  from faiss.contrib.exhaustive_search import knn_ground_truth, range_ground_truth, range_search_gpu, range_search_max_results, exponential_query_iterator
label_desc: Use image node_id 1 for calling the TestBigBatchSearch obj's underlying member method code with example usage: obj.do_test(factory_string) and returns: faiss, faiss