code: def test_multihash(self):
      d = 128
      nq = 100
      nb = 2000
  
      (_, xb, xq) = make_binary_dataset(d, 0, nb, nq)
  
      index_ref = faiss.IndexBinaryFlat(d)
      index_ref.add(xb)
  
      radius = 55
  
      Lref, Dref, Iref = index_ref.range_search(xq, radius)
  
      print("nb res: ", Lref[-1])
  
      nfound = []
      ndis = []
  
      for nh in 1, 3, 5:
          index = faiss.IndexBinaryMultiHash(d, nh, 10)
          index.add(xb)
          # index.display()
          stats = faiss.cvar.indexBinaryHash_stats
          index.nflip = 2
          stats.reset()
          Lnew, Dnew, Inew = index.range_search(xq, radius)
          for i in range(nq):
              ref = Iref[Lref[i] : Lref[i + 1]]
              new = Inew[Lnew[i] : Lnew[i + 1]]
              snew = set(new)
              # no duplicates
              self.assertTrue(len(new) == len(snew))
              # subset of real results
              self.assertTrue(snew <= set(ref))
          nfound.append(Lnew[-1])
          ndis.append(stats.ndis)
      print("nfound=", nfound)
      print("ndis=", ndis)
      nfound = np.array(nfound)
      # self.assertTrue(nfound[-1] == Lref[-1])
      self.assertTrue(np.all(nfound[1:] >= nfound[:-1]))
  
file_path: faiss/tests/test_binary_hashindex.py
imports: import unittest
  import numpy
  import faiss
  from common_faiss_tests import make_binary_dataset
label_desc: Use image node_id 2 for calling the TestRange obj's underlying member method code with example usage: obj.test_multihash() without return types