Skip to content

Commit a6465d1

Browse files
committed
Improved to_numpy method for SparseVector [skip ci]
1 parent cf0f4e9 commit a6465d1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pgvector/sparsevec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def to_list(self) -> list[float]:
7474
def to_numpy(self) -> np.ndarray[tuple[int, ...], np.dtype[np.float32]]:
7575
import numpy as np
7676

77-
vec = np.repeat(0.0, self._dim).astype(np.float32)
77+
vec = np.zeros(self._dim, dtype=np.float32)
7878
for i, v in zip(self._indices, self._values):
7979
vec[i] = v
8080
return vec

0 commit comments

Comments
 (0)