class_docstr: Test the IDSelector filtering for as many (index class, id selector class)
  combinations as possible.
class_docstr_tok: ["Test","the","IDSelector","filtering","for","as","many","(","index","class",",","id","selector","class",")","combinations","as","possible","."]
code: def test_idmap(self):
      ds = datasets.SyntheticDataset(32, 100, 100, 20)
      rs = np.random.RandomState(123)
      ids = rs.choice(10000, size=100, replace=False)
      mask = ids % 2 == 0
      index = faiss.index_factory(ds.d, "IDMap,SQ8")
      index.train(ds.get_train())
  
      # ref result
      index.add_with_ids(ds.get_database()[mask], ids[mask])
      Dref, Iref = index.search(ds.get_queries(), 10)
  
      # with selector
      index.reset()
      index.add_with_ids(ds.get_database(), ids)
  
      valid_ids = ids[mask]
      sel = faiss.IDSelectorTranslated(
          index, faiss.IDSelectorBatch(valid_ids)
      )
  
      Dnew, Inew = index.search(
          ds.get_queries(), 10, params=faiss.SearchParameters(sel=sel)
      )
      np.testing.assert_array_equal(Iref, Inew)
      np.testing.assert_array_almost_equal(Dref, Dnew, decimal=5)
  
      # let the IDMap::search add the translation...
      Dnew, Inew = index.search(
          ds.get_queries(),
          10,
          params=faiss.SearchParameters(
              sel=faiss.IDSelectorBatch(valid_ids)
          ),
      )
      np.testing.assert_array_equal(Iref, Inew)
      np.testing.assert_array_almost_equal(Dref, Dnew, decimal=5)
  
imports: import numpy
  import faiss
  import unittest
  import sys
  import gc
  from faiss.contrib import datasets
  from faiss.contrib.evaluation import sort_range_res_2, check_ref_range_results
label_desc: Use image node_id 19 for calling the TestSelector obj's underlying member method code with example usage: obj.test_idmap() without return types