-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python IndexBinaryFlat.reconstruct_n()
broken
#2751
Comments
This is because the reconstruct_n function is not wrapped in python. The proper way of calling it is with:
But it would be better if the function was wrapped properly, hence the enhancement. |
@mdouze Thank you! But there is still something weird going on. Running this with import numpy as np
import faiss
arr = np.random.randint(0, 256, size=(100, 10), dtype=np.uint8)
index = faiss.IndexBinaryFlat(arr.shape[1] * 8)
index.add(arr)
verify = np.empty((index.ntotal, index.d), dtype=np.uint8)
index.reconstruct_n(0, index.ntotal, faiss.swig_ptr(verify))
verify = verify[:,:index.d // 8]
assert np.array_equal(arr, verify)
|
Summary: **Context** [Issue 2751](facebookresearch#2751) is already fixed as class wrappers has replacement definition of reconstruct_n in handle_IndexBinary. **In this diff**, Writing test test_reconstruct for binary index to validate fix for above issue. Differential Revision: D55168600
Summary: Pull Request resolved: #3310 **Context** [Issue 2751](#2751) is already fixed as class wrappers has replacement definition of reconstruct_n in handle_IndexBinary. **In this diff**, Writing test test_reconstruct for binary index to validate fix for above issue. Reviewed By: junjieqi Differential Revision: D55168600 fbshipit-source-id: b62dc5fa89d65b843c52faa7456f046142e34421
Summary: Pull Request resolved: facebookresearch#3310 **Context** [Issue 2751](facebookresearch#2751) is already fixed as class wrappers has replacement definition of reconstruct_n in handle_IndexBinary. **In this diff**, Writing test test_reconstruct for binary index to validate fix for above issue. Reviewed By: junjieqi Differential Revision: D55168600 fbshipit-source-id: b62dc5fa89d65b843c52faa7456f046142e34421
Summary
reconstruct_n
on aIndexBinaryFlat
throws a TypeError about a additional argument for the reconstructed vectors. Other Indexes simply return them. Also providing aNone
value simply crashes Python.EDIT: It looks like the
reconstruct_n
definition is missing forhandle_IndexBinary
(?)faiss/faiss/python/class_wrappers.py
Line 694 in 52dee5c
Platform
OS: Windows 10
Python version: 3.8.10
Faiss version: faiss-cpu==1.7.3
Installed from: pip
Running on:
Interface:
Reproduction instructions
See summary.
The text was updated successfully, but these errors were encountered: