MCPcopy Create free account
hub / github.com/VectorDB-NTU/RaBitQ-Library / write_ivecs

Function write_ivecs

python/utils/io.py:17–26  ·  view source on GitHub ↗
(filename, m)

Source from the content-addressed store, hash-verified

15 return read_ivecs(filename).view("float32")
16
17
18def write_ivecs(filename, m):
19 print(f"Writing File - {filename}")
20 n, d = m.shape
21 myimt = "i" * d
22 with open(filename, "wb") as f:
23 for i in range(n):
24 f.write(struct.pack("i", d))
25 bin = struct.pack(myimt, *m[i])
26 f.write(bin)
27 print(f"\t{filename} wrote")
28
29

Callers 2

ivf.pyFile · 0.90
write_fvecsFunction · 0.85

Calls 2

packMethod · 0.80
printFunction · 0.50

Tested by

no test coverage detected