Skip to content

Commit b553de9

Browse files
committed
mix bug
1 parent 59e737f commit b553de9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Faiss的使用/002-IndexIVFFlat检索.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
quantizer = faiss.IndexFlatL2(d)
2828
# 量化器索引
2929
index = faiss.IndexIVFFlat(quantizer, d, nlist, faiss.METRIC_L2)
30+
3031
# 指定用L2距离进行搜索,若不指定默认为內积
3132
assert not index.is_trained
3233
index.train(xb)
@@ -36,4 +37,5 @@
3637
# 向量添加
3738
D, I = index.search(xq, k)
3839
# 检索
40+
print(D[:5])
3941
print(I[:5])

0 commit comments

Comments
 (0)