kyamagu / faiss-wheels

Unofficial faiss wheel builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why did faiss.ProductQuantizer() get an incorrect result?

yuleung opened this issue · comments

code:
import numpy as np
import faiss

ver = np.random.randn(1000,512)
ver = ver .astype(np.float32)
print(ver .shape)
pq = faiss.ProductQuantizer(512, 4, 3) #dim:512 seg:4 bit:3
pq.train(ver)
codes = pq.compute_codes(ver)
print(codes.shape)
print(codes)

result: #got seg:2
(1000, 512)
(1000, 2)
[[ 58 5]
[ 62 7]
[ 63 11]
...
[171 7]
[ 57 7]
[ 92 1]]

@yuleung This repository is merely a build automation for faiss pypi packages. Ask the usage question in the official repository.