We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
in method 'IndexBinary_range_search', argument 3 of type 'uint8_t const *'
-- macOS 10.14
Faiss version: 1.4.0
Running on:
Interface:
index = faiss.IndexBinaryFlat(64) xb = np.random.randint(low=0,high=255,size=(1000,64//8)).astype(np.uint8) index.add(xb) xq = np.random.randint(low=0,high=255,size=(2,64//8)).astype(np.uint8) result=[] index.range_search(len(xq),xq,2,result)
return _swigfaiss.IndexBinary_range_search(self, n, x, radius, result)
TypeError: in method 'IndexBinary_range_search', argument 3 of type 'uint8_t const *'
In python, how I give it a parameter of type 'uint8_t const *'?
The text was updated successfully, but these errors were encountered:
Range search is currently not implemented on binary indices.
Sorry, something went wrong.
In case it is useful, here is a function that computes the pairwise distances between two matrices:
def pairwise_hamming_dis(a, b): """ compute the pairwise Hamming distances between two matrices """ na, d = a.shape nb, d2 = b.shape assert d == d2 dis = np.empty((na, nb), dtype='int32') faiss.hammings( faiss.swig_ptr(a), faiss.swig_ptr(b), na, nb, d, faiss.swig_ptr(dis) ) return dis
Then the range search can be performed with
dis = pairwise_hamming_dis(xq, xb) I, J = np.where(dis < threshold)
It is not ideal but definitely faster than doing the loops in Python.
No branches or pull requests
Summary
in method 'IndexBinary_range_search', argument 3 of type 'uint8_t const *'
Platform
-- macOS 10.14
Faiss version: 1.4.0
Running on:
Interface:
Reproduction instructions
program:
index = faiss.IndexBinaryFlat(64)
xb = np.random.randint(low=0,high=255,size=(1000,64//8)).astype(np.uint8)
index.add(xb)
xq = np.random.randint(low=0,high=255,size=(2,64//8)).astype(np.uint8)
result=[]
index.range_search(len(xq),xq,2,result)
error:
return _swigfaiss.IndexBinary_range_search(self, n, x, radius, result)
TypeError: in method 'IndexBinary_range_search', argument 3 of type 'uint8_t const *'
In python, how I give it a parameter of type 'uint8_t const *'?
The text was updated successfully, but these errors were encountered: