Skip to content

Commit 1d88d49

Browse files
committed
fix a few issues
1 parent 9ff406b commit 1d88d49

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
# TODO: to add test_arraymanipulation.py back to the scope once crash on Windows is gone
1414
TEST_SCOPE: >-
1515
test_arraycreation.py
16+
test_amin_amax.py
1617
test_dot.py
1718
test_dparray.py
1819
test_copy.py

dpnp/dpnp_iface_statistics.py

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
363363
364364
Limitations
365365
-----------
366-
Input array `a` is only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
367-
Parameters `out`, `where`, and `initial` are supported only with their default values.
368-
Otherwise the function will be executed sequentially on CPU.
366+
Input and output arrays are only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
367+
Parameters `where`, and `initial` are supported only with their default values.
368+
Otherwise ``NotImplementedError`` exception will be raised.
369369
Input array data types are limited by supported DPNP :ref:`Data types`.
370370
371371
See Also
@@ -400,11 +400,11 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
400400

401401
if initial is not None:
402402
raise NotImplementedError(
403-
"initial keyword arguemnts is only supported by its default value."
403+
"initial keyword arguemnt is only supported by its default value."
404404
)
405405
elif where is not True:
406406
raise NotImplementedError(
407-
"where keyword arguemnts is only supported by its default values."
407+
"where keyword arguemnt is only supported by its default values."
408408
)
409409
else:
410410
dpt_array = dpnp.get_usm_ndarray(a)
@@ -431,21 +431,17 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
431431
raise ValueError(
432432
f"Output array of shape {result.shape} is needed, got {out.shape}."
433433
)
434-
elif out.dtype != result.dtype:
435-
raise ValueError(
436-
f"Output array of type {result.dtype} is needed, got {out.dtype}."
437-
)
438434
elif not isinstance(out, dpnp_array):
439435
if isinstance(out, dpt.usm_ndarray):
440-
out = dpnp.array(out)
436+
out = dpnp_array._create_from_usm_ndarray(out)
441437
else:
442-
raise ValueError(
443-
"An array must be any of supported type, but got {}".format(
438+
raise TypeError(
439+
"Output array must be any of supported type, but got {}".format(
444440
type(out)
445441
)
446442
)
447443

448-
dpnp.copyto(out, result)
444+
dpnp.copyto(out, result, casting="safe")
449445

450446
return out
451447

@@ -610,9 +606,9 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
610606
611607
Limitations
612608
-----------
613-
Input array `a` is only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
614-
Parameters `out`, `where`, and `initial` are supported only with their default values.
615-
Otherwise the function will be executed sequentially on CPU.
609+
Input and output arrays are only supported as either :class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
610+
Parameters `where`, and `initial` are supported only with their default values.
611+
Otherwise ``NotImplementedError`` exception will be raised.
616612
Input array data types are limited by supported DPNP :ref:`Data types`.
617613
618614
See Also
@@ -647,11 +643,11 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
647643

648644
if initial is not None:
649645
raise NotImplementedError(
650-
"initial keyword arguemnts is only supported by its default value."
646+
"initial keyword arguemnt is only supported by its default value."
651647
)
652648
elif where is not True:
653649
raise NotImplementedError(
654-
"where keyword arguemnts is only supported by its default values."
650+
"where keyword arguemnt is only supported by its default values."
655651
)
656652
else:
657653
dpt_array = dpnp.get_usm_ndarray(a)
@@ -678,21 +674,17 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
678674
raise ValueError(
679675
f"Output array of shape {result.shape} is needed, got {out.shape}."
680676
)
681-
elif out.dtype != result.dtype:
682-
raise ValueError(
683-
f"Output array of type {result.dtype} is needed, got {out.dtype}."
684-
)
685677
elif not isinstance(out, dpnp_array):
686678
if isinstance(out, dpt.usm_ndarray):
687-
out = dpnp.array(out)
679+
out = dpnp_array._create_from_usm_ndarray(out)
688680
else:
689-
raise ValueError(
690-
"An array must be any of supported type, but got {}".format(
681+
raise TypeError(
682+
"Output array must be any of supported type, but got {}".format(
691683
type(out)
692684
)
693685
)
694686

695-
dpnp.copyto(out, result)
687+
dpnp.copyto(out, result, casting="safe")
696688

697689
return out
698690

0 commit comments

Comments
 (0)