Skip to content

Instantly share code, notes, and snippets.

@mdouze
Created July 6, 2020 14:38
Show Gist options
  • Save mdouze/94d1d18f4fa84ef58350d54509a7bb3f to your computer and use it in GitHub Desktop.
Save mdouze/94d1d18f4fa84ef58350d54509a7bb3f to your computer and use it in GitHub Desktop.
diff --git a/faiss/gpu/test/test_pytorch_faiss.py b/faiss/gpu/test/test_pytorch_faiss.py
--- a/faiss/gpu/test/test_pytorch_faiss.py
+++ b/faiss/gpu/test/test_pytorch_faiss.py
@@ -86,10 +86,19 @@
D_ptr = swig_ptr_from_FloatTensor(D)
I_ptr = swig_ptr_from_LongTensor(I)
- faiss.bruteForceKnn(res, metric,
- xb_ptr, xb_row_major, nb,
- xq_ptr, xq_row_major, nq,
- d, k, D_ptr, I_ptr)
+ args = faiss.GpuDistanceParams()
+ args.metric = metric
+ args.k = k
+ args.dims = d
+ args.vectors = xb_ptr
+ args.vectorsRowMajor = xb_row_major
+ args.numVectors = nb
+ args.queries = xq_ptr
+ args.queriesRowMajor = xq_row_major
+ args.numQueries = nq
+ args.outDistances = D_ptr
+ args.outIndices = I_ptr
+ faiss.bfKnn(res, args)
return D, I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment