mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Fix flaky test_hnsw smoke test by increasing efSearch (#5222)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5222 test_wheel_smoke::TestIndexFactory::test_hnsw assumes HNSW returns the query vector itself as the nearest neighbor, but the default efSearch (16) is too low to guarantee self-retrieval on 2000 random vectors in d=64. This caused intermittent failures on macOS CI. Set efSearch=64 so the search explores enough of the graph to find exact matches reliably. ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: faiss Differential Revision: D105621052 fbshipit-source-id: 80ccd2ec5aecfb88d2fad780449bfb49d5d18db5
This commit is contained in:
committed by
meta-codesync[bot]
parent
8d3cc92536
commit
5c92c5c1ee
@@ -101,6 +101,7 @@ class TestIndexFactory(unittest.TestCase):
|
||||
np.random.seed(42)
|
||||
xb = np.random.random((n, d)).astype("float32")
|
||||
index = faiss.IndexHNSWFlat(d, 16)
|
||||
index.hnsw.efSearch = 64
|
||||
index.add(xb)
|
||||
assert index.ntotal == n
|
||||
D, I = index.search(xb[:5], 10)
|
||||
|
||||
Reference in New Issue
Block a user