We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66eef36 commit cf0f4e9Copy full SHA for cf0f4e9
1 file changed
pgvector/sparsevec.py
@@ -80,7 +80,8 @@ def to_numpy(self) -> np.ndarray[tuple[int, ...], np.dtype[np.float32]]:
80
return vec
81
82
def to_text(self) -> str:
83
- return '{' + ','.join([f'{int(i) + 1}:{float(v)}' for i, v in zip(self._indices, self._values)]) + '}/' + str(int(self._dim))
+ elements = ','.join([f'{int(i) + 1}:{float(v)}' for i, v in zip(self._indices, self._values)])
84
+ return f'{{{elements}}}/{int(self._dim)}'
85
86
def to_binary(self) -> bytes:
87
nnz = len(self._indices)
0 commit comments