-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
21 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ test-python: | |
|
||
test: | ||
make test-loadable | ||
#make test-python | ||
make test-python | ||
|
||
|
||
test-loadable-3.41.0: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://github.com/facebookresearch/faiss/blob/74ee67aefc21859e02388f32f4876a0cbd21cabd/contrib/vecs_io.py#L20 | ||
|
||
import numpy as np | ||
|
||
def ivecs_read(fname): | ||
a = np.fromfile(fname, dtype='int32') | ||
d = a[0] | ||
return a.reshape(-1, d + 1)[:, 1:].copy() | ||
|
||
|
||
def fvecs_read(fname): | ||
return ivecs_read(fname).view('float32') | ||
|
||
if __name__ == "__main__": | ||
fv = fvecs_read('tests/data/siftsmall/siftsmall_base.fvecs') | ||
print(fv.shape) | ||
print(fv[0]) | ||
print(fv[1]) | ||
for i, row in enumerate(fv[:10]): | ||
print(i, sum(row)) |
This file was deleted.
Oops, something went wrong.