Skip to content

Commit

Permalink
small clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
asg017 committed Apr 7, 2023
1 parent 70b40bd commit 1053147
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test-python:

test:
make test-loadable
#make test-python
make test-python


test-loadable-3.41.0:
Expand Down
20 changes: 20 additions & 0 deletions tests/np.py
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))
16 changes: 0 additions & 16 deletions tests/test-sqlite-vector.sql

This file was deleted.

0 comments on commit 1053147

Please sign in to comment.