Skip to content

Replace numpy._NoValue to default value for min and max functions #1572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dpnp/dparray.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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.
"""
Expand Down
13 changes: 6 additions & 7 deletions dpnp/dpnp_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# *****************************************************************************

import dpctl.tensor as dpt
import numpy

import dpnp

Expand Down Expand Up @@ -907,9 +906,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."""

Expand All @@ -924,9 +923,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."""

Expand Down
5 changes: 2 additions & 3 deletions dpnp/dpnp_iface_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ def nanvar(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
Parameter `axis` is supported only with default value ``None``.
Parameter `dtype` is supported only with default value ``None``.
Parameter `out` is supported only with default value ``None``.
Parameter `keepdims` is supported only with default value ``numpy._NoValue``.
Otherwise the function will be executed sequentially on CPU.
"""

Expand Down Expand Up @@ -665,7 +664,7 @@ def std(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
Parameter `axis` is supported only with default value ``None``.
Parameter `dtype` is supported only with default value ``None``.
Parameter `out` is supported only with default value ``None``.
Parameter `keepdims` is supported only with default value ``numpy._NoValue``.
Parameter `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`.

Expand Down Expand Up @@ -723,7 +722,7 @@ def var(x1, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
Parameter `axis` is supported only with default value ``None``.
Parameter `dtype` is supported only with default value ``None``.
Parameter `out` is supported only with default value ``None``.
Parameter `keepdims` is supported only with default value ``numpy._NoValue``.
Parameter `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`.

Expand Down
7 changes: 7 additions & 0 deletions tests/skipped_tests.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,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
Expand Down
7 changes: 7 additions & 0 deletions tests/skipped_tests_gpu.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,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
Expand All @@ -296,6 +302,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
Expand Down