Skip to content

Commit

Permalink
Relax IVF AQ FastScan (#2940)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #2940

This test fails on some occasions.
After investigation it turns out this is due to non reproducible behavior IndexIVFFastScan::search_implem_14 with a parallel loop, where there are ties in the resutls (ie. the resulting distances are the same but not the ids).
As a workaround I relaxed the test slightly.
+ a fix in the checksum function.

Reviewed By: algoriddle

Differential Revision: D47229086

fbshipit-source-id: 55e53bcfe47cf33041cc7fd5691b5de65067ce0f
  • Loading branch information
mdouze authored and facebook-github-bot committed Jul 6, 2023
1 parent a757806 commit 43d86e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion faiss/python/extra_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def checksum(a):
""" compute a checksum for quick-and-dirty comparisons of arrays """
a = a.view('uint8')
if a.ndim == 1:
return bvec_checksum(s.size, swig_ptr(a))
return bvec_checksum(a.size, swig_ptr(a))
n, d = a.shape
cs = np.zeros(n, dtype='uint64')
bvecs_checksum(n, d, swig_ptr(a), swig_ptr(cs))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fast_scan_ivf.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def subtest_accuracy(self, aq, st, by_residual, implem, metric_type='L2'):
recall1 = (I1 == gt).sum() / nq

print(aq, st, by_residual, implem, metric_type, recall_ref, recall1)
assert abs(recall_ref - recall1) < 0.05
assert abs(recall_ref - recall1) < 0.051

def xx_test_accuracy(self):
# generated programatically below
Expand Down

0 comments on commit 43d86e3

Please sign in to comment.