8000 ENH: euclidean_distances: precompute blocks of X_norm_squared · scikit-learn/scikit-learn@8aecbde · GitHub
[go: up one dir, main page]

Skip to content

Commit 8aecbde

Browse files
committed
ENH: euclidean_distances: precompute blocks of X_norm_squared
Signed-off-by: Celelibi <celelibi@gmail.com>
1 parent 3b7ad89 commit 8aecbde

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/metrics/pairwise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _euclidean_distances_cast(X, Y, outdtype, Y_norm_squared=None,
241241
if X_norm_squared is not None:
242242
Xnc = _cast_if_needed(X_norm_squared[i:ipbs, :], np.float64)
243243
else:
244-
Xnc = None
244+
Xnc = row_norms(Xc, squared=True)[:, np.newaxis]
245245

246246
for j in range(i, Y.shape[0], bs):
247247
jpbs = min(j + bs, Y.shape[0])

0 commit comments

Comments
 (0)
0