fix centroids_norms storage for ResidualCoarseQuantizer (#2018)

Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2018

The centroids norms table was not reconstructed correctly after being stored in RCQ.

Reviewed By: Sugoshnr

Differential Revision: D30484389

fbshipit-source-id: 9f618a3939c99dc987590c07eda8e76e19248b08
This commit is contained in:
Matthijs Douze
2021-08-25 06:37:33 -07:00
committed by Facebook GitHub Bot
parent 760cce7f3a
commit 151e3d7be5
2 changed files with 14 additions and 2 deletions
+7
View File
@@ -497,6 +497,13 @@ class TestIVFResidualCoarseQuantizer(unittest.TestCase):
np.testing.assert_array_almost_equal(Dref, Dnew, decimal=5)
np.testing.assert_array_equal(Iref, Inew)
# check i/o
CDref, CIref = quantizer.search(ds.get_queries(), 10)
quantizer2 = faiss.deserialize_index(faiss.serialize_index(quantizer))
quantizer2.search(ds.get_queries(), 10)
CDnew, CInew = quantizer2.search(ds.get_queries(), 10)
np.testing.assert_array_almost_equal(CDref, CDnew, decimal=5)
np.testing.assert_array_equal(CIref, CInew)
###########################################################
# Test search with LUTs