提交 de948ae0 编写于 作者: X xj.lin

update faiss_wrapper

上级 fc955a6a
......@@ -2,27 +2,32 @@ import faiss
import numpy as np
class FaissSearch():
def __init__(self, index, id_to_vector_map):
pass
def __init__(self, index, id_to_vector_map=None):
self.__index = index
if id_to_vector_map is None:
self.__id_to_vector_map = []
# def search_by_ids(self, id_list, k):
# pass
def search_by_vectors(self, vector_list, k):
# return both id and vector
pass
def __search__(self, id_list, vector_list, k):
pass
class FaissIndex():
def build_index(self, vector_list, dimension):
# return index
pass
# def build_index_cpu(self):
# pass
# def build_index_gpu(self):
# pass
\ No newline at end of file
id_list = [None] * len(vector_list)
result = self.__search(id_list, vector_list, k)
return result
def __search(self, id_list, vector_list, k):
D, I = self.__index.search(vector_list, k)
return I
# class FaissIndex():
# def build_index(self, vector_list, dimension):
# # return index
# pass
#
# def build_index_cpu(self):
# pass
#
# def build_index_gpu(self):
# pass
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册