facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
30.69k stars 3.58k forks source link

Conversion of np int64 and float64 to SWIG int and float #3866

Open mdouze opened 1 week ago

mdouze commented 1 week ago

Faiss does not transparently convert numpy int64 and float64 / float32 to SWIG's int and float

import faiss
import numpy as np

a = np.array([4, 6])

d = a[0]
faiss.IndexFlatL2(d) # fails 
faiss.IndexFlatL2(int(d)) # works

It should be possible to fix it with SWIG typemaps

asadoughi commented 1 week ago

Related to #3628?