-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Can PyTorch Tensors be used as the index? #561
Comments
No, you'll need to convert your tensor to a numpy array. |
Thank you. 😢 |
@moskomule Note that, as mentioned here, it is just a matter of doing |
I see. But in my case, |
See here on how to pass pytorch GPU tensors without copying them: |
@mdouze Thank you. You mean |
The link above is incorrect now. Access https://github.com/facebookresearch/faiss/blob/master/faiss/gpu/test/test_pytorch_faiss.py instead. |
https://github.com/facebookresearch/faiss/blob/master/faiss/gpu/test/test_pytorch_faiss.py and https://github.com/facebookresearch/faiss/blob/master/gpu/test/test_pytorch_faiss.py go to 404 error for me. |
@skei0 yes, import faiss.contrib.torch_utils (https://github.com/facebookresearch/faiss/blob/master/contrib/torch_utils.py) and you can simply pass a pytorch tensor as xb. |
Hi, I'm trying to use FAISS with PyTorch (both are the latest versions available via
conda install -c pytorch ...
). In https://github.com/facebookresearch/faiss/blob/master/gpu/test/test_pytorch_faiss.py, the index is constructed as follows.Is it possible to use PyTorch's Tensor as
xb
above? Thank you.At least
index.add(torch_tensor)
doesn't work.The text was updated successfully, but these errors were encountered: