Dear all, does anyone know why the following code could return negative entries for D? I am calculating the L2-nearest neighbors of CIFAR images, for which I assume IndexFlatL2 should return non-negative distances (and 0 for exact match).
index = faiss.IndexFlatL2(d)
index.add(Data)
D, I = index.search(Data, 10)
Some notes:
- The most problematic case seems to be when some feature dimensions have significantly larger variance than the others, in which case the negative entries can be quite large (say around -10^3).
- I get the same problem using either CPU or GPU.
- I get correct results running the tutorial code
1-Flat.py.
Thanks!