Skip to content

Commit a1007dd

Browse files
mdouzeaalekhpatel07
authored andcommitted
selector parameter for FastScan (facebookresearch#3362)
Summary: Pull Request resolved: facebookresearch#3362 Add test to Alex' PR Reviewed By: junjieqi Differential Revision: D56003946 fbshipit-source-id: 5a8a881d450bc97ae0777d73ce0ce8607ec6b686
1 parent 05cd509 commit a1007dd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/test_search_params.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ class TestSelector(unittest.TestCase):
2222
combinations as possible.
2323
"""
2424

25-
def do_test_id_selector(self, index_key, id_selector_type="batch", mt=faiss.METRIC_L2):
25+
def do_test_id_selector(self, index_key, id_selector_type="batch", mt=faiss.METRIC_L2, k=10):
2626
""" Verify that the id selector returns the subset of results that are
2727
members according to the IDSelector.
2828
Supports id_selector_type="batch", "bitmap", "range", "range_sorted", "and", "or", "xor"
2929
"""
3030
ds = datasets.SyntheticDataset(32, 1000, 100, 20)
3131
index = faiss.index_factory(ds.d, index_key, mt)
3232
index.train(ds.get_train())
33-
k = 10
3433

3534
# reference result
3635
if "range" in id_selector_type:
@@ -145,6 +144,16 @@ def test_IVFFlat_range_sorted(self):
145144
def test_IVFPQ(self):
146145
self.do_test_id_selector("IVF32,PQ4x4np")
147146

147+
def test_IVFPQfs(self):
148+
self.do_test_id_selector("IVF32,PQ4x4fs")
149+
150+
def test_IVFPQfs_k1(self):
151+
self.do_test_id_selector("IVF32,PQ4x4fs", k=1)
152+
153+
def test_IVFPQfs_k40(self):
154+
# test reservoir codepath
155+
self.do_test_id_selector("IVF32,PQ4x4fs", k=40)
156+
148157
def test_IVFSQ(self):
149158
self.do_test_id_selector("IVF32,SQ8")
150159

0 commit comments

Comments
 (0)