Skip to content

Commit 6c1238c

Browse files
committed
Added comments [skip ci]
1 parent 326cff5 commit 6c1238c

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

pgvector/halfvec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self, value: list[float] | np.ndarray[tuple[int], np.dtype[np.float
2525
if value.dtype != np.float16:
2626
value = np.asarray(value, dtype=np.float16)
2727

28+
# tobytes() important for performance
2829
self._value = array.array('H', value.tobytes())
2930
else:
3031
raise ValueError('expected list or ndarray')

pgvector/vector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, value: list[float] | np.ndarray[tuple[int], np.dtype[np.float
2424
if value.dtype != np.float32:
2525
value = np.asarray(value, dtype=np.float32)
2626

27+
# tobytes() important for performance
2728
self._value = array.array('f', value.tobytes())
2829
else:
2930
raise ValueError('expected list or ndarray')

0 commit comments

Comments
 (0)