mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
15 lines
305 B
Python
15 lines
305 B
Python
import faiss
|
|
import numpy as np
|
|
|
|
def write_index(index, file_name):
|
|
faiss.write_index(index, file_name)
|
|
|
|
def read_index(file_name):
|
|
return faiss.read_index(file_name)
|
|
|
|
def to_array(vec):
|
|
return np.asarray(vec).astype('float32')
|
|
|
|
def to_str_array(vec):
|
|
return np.asarray(vec).astype('str')
|