Skip to content

Commit 112befd

Browse files
committed
Simplify fast_dot.
1 parent d6e722a commit 112befd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sklearn/utils/extmath.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,15 @@ def fast_dot(A, B):
155155
if LooseVersion(np.__version__) < '1.7.2': # backported
156156
try:
157157
linalg.get_blas_funcs(['gemm'])
158-
try:
159-
return _fast_dot(A, B)
160-
except ValueError:
161-
return np.dot(A, B)
162158
except (AttributeError, ValueError):
163159
warnings.warn('Could not import BLAS, falling back to np.dot')
164160
return np.dot(A, B)
161+
162+
try:
163+
return _fast_dot(A, B)
164+
except ValueError:
165+
# Maltyped or malformed data.
166+
return np.dot(A, B)
165167
else:
166168
return np.dot(A, B)
167169

0 commit comments

Comments
 (0)