Skip to content

Commit 2cff2f8

Browse files
committed
Reduced copying in _from_sparse method [skip ci]
1 parent 2ae28ba commit 2cff2f8

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
@@ -100,7 +100,7 @@ def _from_dict(self, d: dict[int, float], dim: int) -> None:
100100
self._values = [float(v[1]) for v in elements]
101101

102102
def _from_sparse(self, arr: sparray | spmatrix) -> None:
103-
value: coo_array | coo_matrix = arr.tocoo() # type: ignore
103+
value: coo_array | coo_matrix = arr.tocoo(copy=False) # type: ignore
104104

105105
shape = cast(tuple[int], value.shape)
106106
if len(shape) == 1:

0 commit comments

Comments
 (0)