Skip to content

Commit 6c3991d

Browse files
committed
address comments
1 parent ac768f9 commit 6c3991d

File tree

6 files changed

+30
-35
lines changed

6 files changed

+30
-35
lines changed

dpnp/dpnp_algo/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ set(dpnp_algo_pyx_deps
88
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_sorting.pxi
99
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_arraycreation.pxi
1010
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_mathematical.pxi
11-
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_searching.pxi
1211
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_indexing.pxi
1312
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_logic.pxi
1413
${CMAKE_CURRENT_SOURCE_DIR}/dpnp_algo_special.pxi

dpnp/dpnp_algo/dpnp_algo.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ include "dpnp_algo_linearalgebra.pxi"
6666
include "dpnp_algo_logic.pxi"
6767
include "dpnp_algo_manipulation.pxi"
6868
include "dpnp_algo_mathematical.pxi"
69-
include "dpnp_algo_searching.pxi"
7069
include "dpnp_algo_sorting.pxi"
7170
include "dpnp_algo_special.pxi"
7271
include "dpnp_algo_statistics.pxi"

dpnp/dpnp_array.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,6 @@ def argmax(self, axis=None, out=None):
492492
493493
Refer to :obj:`dpnp.argmax` for full documentation.
494494
495-
Examples
496-
--------
497-
>>> import dpnp as np
498-
>>> a = np.arange(6).reshape(2,3)
499-
>>> a.argmax()
500-
array(5)
501-
>>> a.argmax(0)
502-
array([1, 1, 1])
503-
>>> a.argmax(1)
504-
array([2, 2])
505-
506495
"""
507496
return dpnp.argmax(self, axis, out)
508497

dpnp/dpnp_iface_searching.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
__all__ = ["argmax", "argmin", "searchsorted", "where"]
5050

5151

52-
def argmax(a, axis=None, out=None, keepdims=False):
52+
def argmax(a, axis=None, out=None, *, keepdims=False):
5353
"""
5454
Returns the indices of the maximum values along an axis.
5555
@@ -62,11 +62,13 @@ def argmax(a, axis=None, out=None, keepdims=False):
6262
6363
Limitations
6464
-----------
65-
Input array is only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
65+
Input and output arrays are only supported as either :class:`dpnp.ndarray`
66+
or :class:`dpctl.tensor.usm_ndarray`.
6667
Input array data types are limited by supported DPNP :ref:`Data types`.
6768
6869
See Also
6970
--------
71+
:obj:`dpnp.ndarray.argmax` : Equivalent function.
7072
:obj:`dpnp.argmin` : Returns the indices of the minimum values along an axis.
7173
:obj:`dpnp.amax` : The maximum value along a given axis.
7274
:obj:`dpnp.unravel_index` : Convert a flat index into an index tuple.
@@ -147,7 +149,7 @@ def argmax(a, axis=None, out=None, keepdims=False):
147149
return out
148150

149151

150-
def argmin(a, axis=None, out=None, keepdims=False):
152+
def argmin(a, axis=None, out=None, *, keepdims=False):
151153
"""
152154
Returns the indices of the minimum values along an axis.
153155
@@ -160,11 +162,13 @@ def argmin(a, axis=None, out=None, keepdims=False):
160162
161163
Limitations
162164
-----------
163-
Input array is only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
165+
Input and output arrays are only supported as either :class:`dpnp.ndarray`
166+
or :class:`dpctl.tensor.usm_ndarray`.
164167
Input array data types are limited by supported DPNP :ref:`Data types`.
165168
166169
See Also
167170
--------
171+
:obj:`dpnp.ndarray.argmin` : Equivalent function.
168172
:obj:`dpnp.argmax` : Returns the indices of the maximum values along an axis.
169173
:obj:`dpnp.amin` : The minimum value along a given axis.
170174
:obj:`dpnp.unravel_index` : Convert a flat index into an index tuple.

tests/third_party/cupy/core_tests/test_ndarray_reduction.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,97 +229,101 @@ def test_ptp_nan_imag(self, xp, dtype):
229229
@testing.for_all_dtypes()
230230
@testing.numpy_cupy_allclose(contiguous_check=False)
231231
def test_argmax_all(self, xp, dtype):
232-
a = testing.shaped_random((2, 3), xp, dtype)
232+
a = testing.shaped_random((2, 3), xp, dtype, order=self.order)
233233
return a.argmax()
234234

235235
@testing.for_all_dtypes()
236236
@testing.numpy_cupy_allclose(contiguous_check=False)
237237
def test_argmax_axis_large(self, xp, dtype):
238-
a = testing.shaped_random((3, 1000), xp, dtype)
238+
a = testing.shaped_random((3, 1000), xp, dtype, order=self.order)
239239
return a.argmax(axis=0)
240240

241241
@testing.for_all_dtypes()
242242
@testing.numpy_cupy_allclose(contiguous_check=False)
243243
def test_argmax_axis0(self, xp, dtype):
244-
a = testing.shaped_random((2, 3, 4), xp, dtype)
244+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
245245
return a.argmax(axis=0)
246246

247247
@testing.for_all_dtypes()
248248
@testing.numpy_cupy_allclose(contiguous_check=False)
249249
def test_argmax_axis1(self, xp, dtype):
250-
a = testing.shaped_random((2, 3, 4), xp, dtype)
250+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
251251
return a.argmax(axis=1)
252252

253253
@testing.for_all_dtypes()
254254
@testing.numpy_cupy_allclose(contiguous_check=False)
255255
def test_argmax_axis2(self, xp, dtype):
256-
a = testing.shaped_random((2, 3, 4), xp, dtype)
256+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
257257
return a.argmax(axis=2)
258258

259259
@testing.for_float_dtypes()
260260
@testing.numpy_cupy_allclose(contiguous_check=False)
261261
def test_argmax_nan(self, xp, dtype):
262-
a = xp.array([float("nan"), 1, -1], dtype)
262+
a = xp.array([float("nan"), 1, -1], dtype, order=self.order)
263263
return a.argmax()
264264

265265
@testing.for_complex_dtypes()
266266
@testing.numpy_cupy_allclose(contiguous_check=False)
267267
def test_argmax_nan_real(self, xp, dtype):
268-
a = xp.array([float("nan"), 1, -1], dtype)
268+
a = xp.array([float("nan"), 1, -1], dtype, order=self.order)
269269
return a.argmax()
270270

271271
@testing.for_complex_dtypes()
272272
@testing.numpy_cupy_allclose(contiguous_check=False)
273273
def test_argmax_nan_imag(self, xp, dtype):
274-
a = xp.array([float("nan") * 1.0j, 1.0j, -1.0j], dtype)
274+
a = xp.array(
275+
[float("nan") * 1.0j, 1.0j, -1.0j], dtype, order=self.order
276+
)
275277
return a.argmax()
276278

277279
@testing.for_all_dtypes()
278280
@testing.numpy_cupy_allclose(contiguous_check=False)
279281
def test_argmin_all(self, xp, dtype):
280-
a = testing.shaped_random((2, 3), xp, dtype)
282+
a = testing.shaped_random((2, 3), xp, dtype, order=self.order)
281283
return a.argmin()
282284

283285
@testing.for_all_dtypes()
284286
@testing.numpy_cupy_allclose(contiguous_check=False)
285287
def test_argmin_axis_large(self, xp, dtype):
286-
a = testing.shaped_random((3, 1000), xp, dtype)
288+
a = testing.shaped_random((3, 1000), xp, dtype, order=self.order)
287289
return a.argmin(axis=0)
288290

289291
@testing.for_all_dtypes()
290292
@testing.numpy_cupy_allclose(contiguous_check=False)
291293
def test_argmin_axis0(self, xp, dtype):
292-
a = testing.shaped_random((2, 3, 4), xp, dtype)
294+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
293295
return a.argmin(axis=0)
294296

295297
@testing.for_all_dtypes()
296298
@testing.numpy_cupy_allclose(contiguous_check=False)
297299
def test_argmin_axis1(self, xp, dtype):
298-
a = testing.shaped_random((2, 3, 4), xp, dtype)
300+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
299301
return a.argmin(axis=1)
300302

301303
@testing.for_all_dtypes()
302304
@testing.numpy_cupy_allclose(contiguous_check=False)
303305
def test_argmin_axis2(self, xp, dtype):
304-
a = testing.shaped_random((2, 3, 4), xp, dtype)
306+
a = testing.shaped_random((2, 3, 4), xp, dtype, order=self.order)
305307
return a.argmin(axis=2)
306308

307309
@testing.for_float_dtypes()
308310
@testing.numpy_cupy_allclose(contiguous_check=False)
309311
def test_argmin_nan(self, xp, dtype):
310-
a = xp.array([float("nan"), 1, -1], dtype)
312+
a = xp.array([float("nan"), 1, -1], dtype, order=self.order)
311313
return a.argmin()
312314

313315
@testing.for_complex_dtypes()
314316
@testing.numpy_cupy_allclose(contiguous_check=False)
315317
def test_argmin_nan_real(self, xp, dtype):
316-
a = xp.array([float("nan"), 1, -1], dtype)
318+
a = xp.array([float("nan"), 1, -1], dtype, order=self.order)
317319
return a.argmin()
318320

319321
@testing.for_complex_dtypes()
320322
@testing.numpy_cupy_allclose(contiguous_check=False)
321323
def test_argmin_nan_imag(self, xp, dtype):
322-
a = xp.array([float("nan") * 1.0j, 1.0j, -1.0j], dtype)
324+
a = xp.array(
325+
[float("nan") * 1.0j, 1.0j, -1.0j], dtype, order=self.order
326+
)
323327
return a.argmin()
324328

325329

tests/third_party/cupy/sorting_tests/test_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def test_argmin_all(self, xp, dtype):
9191
a = testing.shaped_random((2, 3), xp, dtype)
9292
return a.argmin()
9393

94-
@testing.for_all_dtypes(no_complex=True)
95-
@testing.numpy_cupy_allclose(accept_error=ValueError)
94+
@testing.for_float_dtypes()
95+
@testing.numpy_cupy_allclose()
9696
def test_argmin_nan(self, xp, dtype):
9797
a = xp.array([float("nan"), -1, 1], dtype)
9898
return a.argmin()

0 commit comments

Comments
 (0)