From dea0c575be0fd565a3bd002c256cfbc0528d860b Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Wed, 3 Jul 2024 13:40:33 +0000 Subject: [PATCH] MAINT: Small NumPy 2 related fixes This applys some smaller NumPy 2 related fixes. With (in progress) cupy 13.2 fixups, the single gpu test suite seems to be doing fine (not quite finished, I may push more commits, but can also open a new PR). The one thinig I noticed that is a bit anonying is that hdbscan is not yet released for NumPy 2, is that actually still required since I think sklearn has a version? (I don't expect this to be a problem for long, but there is at least one odd test failure trying to make hdbscan work in https://github.com/scikit-learn-contrib/hdbscan/pull/644) --- python/cuml/cuml/_thirdparty/sklearn/utils/sparsefuncs.py | 2 +- python/cuml/cuml/internals/array.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/cuml/cuml/_thirdparty/sklearn/utils/sparsefuncs.py b/python/cuml/cuml/_thirdparty/sklearn/utils/sparsefuncs.py index e0697b98ce..7bea44a366 100644 --- a/python/cuml/cuml/_thirdparty/sklearn/utils/sparsefuncs.py +++ b/python/cuml/cuml/_thirdparty/sklearn/utils/sparsefuncs.py @@ -214,7 +214,7 @@ def _sparse_min_or_max(X, axis, min_or_max): if np.isnan(m): if 'nan' in min_or_max: m = 0 - elif X.nnz != cpu_np.product(X.shape): + elif X.nnz != cpu_np.prod(X.shape): if 'min' in min_or_max: m = m if m <= 0 else 0 else: diff --git a/python/cuml/cuml/internals/array.py b/python/cuml/cuml/internals/array.py index 6b664506ae..6873265261 100644 --- a/python/cuml/cuml/internals/array.py +++ b/python/cuml/cuml/internals/array.py @@ -1168,6 +1168,9 @@ def from_input( ) make_copy = force_contiguous and not arr.is_contiguous + if not make_copy: + # NumPy now interprets False as never copy, so must use None + make_copy = None if ( not fail_on_order and order != arr.order and order != "K"