From c2cab1f0f86848957ed6f937a5f2fb6823077494 Mon Sep 17 00:00:00 2001 From: Natalia Polina Date: Tue, 26 Sep 2023 10:56:07 -0500 Subject: [PATCH 1/2] Replace numpy._NoValue to default value for min and max functions --- dpnp/dparray.pyx | 4 ++-- dpnp/dpnp_array.py | 13 ++++++------- dpnp/dpnp_iface_statistics.py | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dpnp/dparray.pyx b/dpnp/dparray.pyx index e8d9dd2e345e..1aacb9ce1a9a 100644 --- a/dpnp/dparray.pyx +++ b/dpnp/dparray.pyx @@ -974,7 +974,7 @@ cdef class dparray: return iface_sum(*args, **kwargs) - def max(self, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue): + def max(self, axis=None, out=None, keepdims=False, initial=None, where=True): """ Return the maximum along an axis. """ @@ -988,7 +988,7 @@ cdef class dparray: return mean(self, axis) - def min(self, axis=None, out=None, keepdims=numpy._NoValue, initial=numpy._NoValue, where=numpy._NoValue): + def min(self, axis=None, out=None, keepdims=False, initial=None, where=True): """ Return the minimum along a given axis. """ diff --git a/dpnp/dpnp_array.py b/dpnp/dpnp_array.py index 252fa17c5b43..e0818b042636 100644 --- a/dpnp/dpnp_array.py +++ b/dpnp/dpnp_array.py @@ -25,7 +25,6 @@ # ***************************************************************************** import dpctl.tensor as dpt -import numpy import dpnp @@ -905,9 +904,9 @@ def max( self, axis=None, out=None, - keepdims=numpy._NoValue, - initial=numpy._NoValue, - where=numpy._NoValue, + keepdims=False, + initial=None, + where=True, ): """Return the maximum along an axis.""" @@ -922,9 +921,9 @@ def min( self, axis=None, out=None, - keepdims=numpy._NoValue, - initial=numpy._NoValue, - where=numpy._NoValue, + keepdims=False, + initial=None, + where=True, ): """Return the minimum along a given axis.""" diff --git a/dpnp/dpnp_iface_statistics.py b/dpnp/dpnp_iface_statistics.py index 2594901039f0..d8ab2ed1247b 100644 --- a/dpnp/dpnp_iface_statistics.py +++ b/dpnp/dpnp_iface_statistics.py @@ -619,7 +619,7 @@ def nanvar(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False): Prameters ``axis`` is supported only with default value ``None``. Prameters ``dtype`` is supported only with default value ``None``. Prameters ``out`` is supported only with default value ``None``. - Prameters ``keepdims`` is supported only with default value ``numpy._NoValue``. + Prameters ``keepdims`` is supported only with default value ``False``. Otherwise the function will be executed sequentially on CPU. """ @@ -665,7 +665,7 @@ def std(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False): Prameters ``axis`` is supported only with default value ``None``. Prameters ``dtype`` is supported only with default value ``None``. Prameters ``out`` is supported only with default value ``None``. - Prameters ``keepdims`` is supported only with default value ``numpy._NoValue``. + Prameters ``keepdims`` is supported only with default value ``False``. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP :ref:`Data types`. @@ -723,7 +723,7 @@ def var(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False): Prameters ``axis`` is supported only with default value ``None``. Prameters ``dtype`` is supported only with default value ``None``. Prameters ``out`` is supported only with default value ``None``. - Prameters ``keepdims`` is supported only with default value ``numpy._NoValue``. + Prameters ``keepdims`` is supported only with default value ``False``. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP :ref:`Data types`. From c4494fc28aba2b0a89af0241b8d95e6b66c06f04 Mon Sep 17 00:00:00 2001 From: Natalia Polina Date: Tue, 26 Sep 2023 16:10:15 -0500 Subject: [PATCH 2/2] Skip tests for min and max functions --- tests/skipped_tests.tbl | 7 +++++++ tests/skipped_tests_gpu.tbl | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index 98cdc65136a9..f151fb480630 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -165,6 +165,13 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction: tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_ptp_nan_imag tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_ptp_nan_real +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan_imag +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan_real +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan_imag +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan_real + tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_min tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_1_{order='C', shape=(10, 20)}::test_cub_max diff --git a/tests/skipped_tests_gpu.tbl b/tests/skipped_tests_gpu.tbl index 3ab40ed4d047..7ae45c0e1824 100644 --- a/tests/skipped_tests_gpu.tbl +++ b/tests/skipped_tests_gpu.tbl @@ -285,6 +285,12 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction: tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_ptp_nan tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_ptp_nan_imag tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_ptp_nan_real +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan_imag +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_max_nan_real +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan_imag +tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestArrayReduction::test_min_nan_real tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_0_{order='C', shape=(10,)}::test_cub_min @@ -302,6 +308,7 @@ tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_pa tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_6_{order='F', shape=(10, 20, 30)}::test_cub_min tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_max tests/third_party/cupy/core_tests/test_ndarray_reduction.py::TestCubReduction_param_7_{order='F', shape=(10, 20, 30, 40)}::test_cub_min + tests/third_party/cupy/creation_tests/test_basic.py::TestBasicReshape_param_0_{shape=4}::test_empty_like_K_strides_reshape tests/third_party/cupy/creation_tests/test_basic.py::TestBasicReshape_param_1_{shape=(4,)}::test_empty_like_K_strides_reshape tests/third_party/cupy/creation_tests/test_basic.py::TestBasicReshape_param_2_{shape=(4, 2)}::test_empty_like_K_strides_reshape