Skip to content

Commit bbe0131

Browse files
agourlayjoein
authored andcommitted
Remove warning for scalar divide with inf
1 parent ef8e772 commit bbe0131

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

qdrant_client/local/distances.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,9 @@ def calculate_distance_core(
165165

166166

167167
def fast_sigmoid(x: np.float32) -> np.float32:
168-
if np.isnan(x):
169-
# To avoid divisions on NaNs, which gets: RuntimeWarning: invalid value encountered in scalar divide
170-
return x # NaN
171-
168+
if np.isnan(x) or np.isinf(x):
169+
# To avoid divisions on NaNs or inf, which gets: RuntimeWarning: invalid value encountered in scalar divide
170+
return x
172171
return x / np.add(1.0, abs(x))
173172

174173

0 commit comments

Comments
 (0)