test_faiss.py 490 B

1234567891011
  1. import numpy as np
  2. d = 64 # 向量维度
  3. nb = 100000 # index向量库的数据量
  4. nq = 10000 # 待检索query的数目
  5. np.random.seed(1234)
  6. xb = np.random.random((nb, d)).astype('float32')
  7. #xb[:, 0] += np.arange(nb) / 1000. # index向量库的向量
  8. xq = np.random.random((nq, d)).astype('float32')
  9. #xq[:, 0] += np.arange(nq) / 1000.
  10. print(xb)