update faiss_wrapper

This commit is contained in:
xj.lin 2019-03-22 11:07:51 +08:00
parent fc955a6a7d
commit de948ae04c

View File

@ -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
id_list = [None] * len(vector_list)
def __search__(self, id_list, vector_list, k):
pass
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
# class FaissIndex():
# def build_index(self, vector_list, dimension):
# # return index
# pass
#
# def build_index_cpu(self):
# pass
#
# def build_index_gpu(self):
# pass