Add missing downcast (#1330)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1330 add missing downcast for Index (and test for github sync) See github issue https://github.com/facebookresearch/faiss/issues/1278 Reviewed By: beauby Differential Revision: D23053182 fbshipit-source-id: 1ce4c248342332ce632ecfd5074affa3ddf55b66pull/1315/head
parent
569c855ed0
commit
4c3b5ad156
|
@ -579,6 +579,7 @@ struct AsyncIndexSearchC {
|
|||
DOWNCAST ( IndexIVFFlat )
|
||||
DOWNCAST ( IndexIVF )
|
||||
DOWNCAST ( IndexFlat )
|
||||
DOWNCAST ( IndexRefineFlat )
|
||||
DOWNCAST ( IndexPQ )
|
||||
DOWNCAST ( IndexScalarQuantizer )
|
||||
DOWNCAST ( IndexLSH )
|
||||
|
|
|
@ -615,6 +615,18 @@ class TestSWIGWrap(unittest.TestCase):
|
|||
|
||||
[index.id_map.at(int(i)) for i in range(index.ntotal)]
|
||||
|
||||
def test_downcast_Refine(self):
|
||||
|
||||
index = faiss.IndexRefineFlat(
|
||||
faiss.IndexScalarQuantizer(10, faiss.ScalarQuantizer.QT_8bit)
|
||||
)
|
||||
|
||||
# serialize and deserialize
|
||||
index2 = faiss.deserialize_index(
|
||||
faiss.serialize_index(index)
|
||||
)
|
||||
|
||||
assert isinstance(index2, faiss.IndexRefineFlat)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue