You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in function try_gpu(line258), weather gpu_index or cpu_index, both call function add_to_index_and_search, but this function only use cpu for faiss search
def add_to_index_and_search(index, query, reference, k):
if reference is not None:
index.add(reference.float().cpu())
return index.search(query.float().cpu(), k)
The text was updated successfully, but these errors were encountered:
When the faiss index is on multiple GPUs, then the inputs have to be on CPU (see facebookresearch/faiss#1997). Inside the function, faiss moves the tensors back to the GPU.
When the index is on a single GPU, then the input tensor can also be on GPU.
Maybe I can add some code to move the tensor to CPU only if the index is on multiple GPUs.
domenicoMuscill0
pushed a commit
to domenicoMuscill0/pytorch-metric-learning
that referenced
this issue
Jun 21, 2023
pytorch_metric_learning.utils.inference
in function try_gpu(line258), weather gpu_index or cpu_index, both call function add_to_index_and_search, but this function only use cpu for faiss search
def add_to_index_and_search(index, query, reference, k):
if reference is not None:
index.add(reference.float().cpu())
return index.search(query.float().cpu(), k)
The text was updated successfully, but these errors were encountered: