Faiss是Facebook AI团队开源的针对聚类和相似性搜索库
用自己数据跑faiss示例代码报错:
%time index = faiss.IndexFlatL2(d) # build the index
print(index.is_trained)
index.add(xb1)
搜了一下是因为faiss要求输入数据必须是连续数据,所以先要对数据进行连续化处理:np.ascontiguousarray
%time index = faiss.IndexFlatL2(d) # build the index
print(index.is_trained)
index.add(np.ascontiguousarray(xb1))
问题解决