Skip to content

Commit 60e4acd

Browse files
authored
FIX avoid warning in input validation with array_api_strict (scikit-learn#29086)
1 parent 5e25db7 commit 60e4acd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sklearn/utils/validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ def _assert_all_finite(
9595
):
9696
"""Like assert_all_finite, but only for ndarray."""
9797

98-
xp, _ = get_namespace(X)
98+
xp, is_array_api = get_namespace(X)
9999

100100
if _get_config()["assume_finite"]:
101101
return
102102

103103
X = xp.asarray(X)
104104

105105
# for object dtype data, we only check for NaNs (GH-13254)
106-
if X.dtype == np.dtype("object") and not allow_nan:
106+
if not is_array_api and X.dtype == np.dtype("object") and not allow_nan:
107107
if _object_dtype_isnan(X).any():
108108
raise ValueError("Input contains NaN")
109109

0 commit comments

Comments
 (0)