@@ -363,9 +363,9 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
363
363
364
364
Limitations
365
365
-----------
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 .
369
369
Input array data types are limited by supported DPNP :ref:`Data types`.
370
370
371
371
See Also
@@ -400,11 +400,11 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
400
400
401
401
if initial is not None :
402
402
raise NotImplementedError (
403
- "initial keyword arguemnts is only supported by its default value."
403
+ "initial keyword arguemnt is only supported by its default value."
404
404
)
405
405
elif where is not True :
406
406
raise NotImplementedError (
407
- "where keyword arguemnts is only supported by its default values."
407
+ "where keyword arguemnt is only supported by its default values."
408
408
)
409
409
else :
410
410
dpt_array = dpnp .get_usm_ndarray (a )
@@ -431,21 +431,17 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
431
431
raise ValueError (
432
432
f"Output array of shape { result .shape } is needed, got { out .shape } ."
433
433
)
434
- elif out .dtype != result .dtype :
435
- raise ValueError (
436
- f"Output array of type { result .dtype } is needed, got { out .dtype } ."
437
- )
438
434
elif not isinstance (out , dpnp_array ):
439
435
if isinstance (out , dpt .usm_ndarray ):
440
- out = dpnp . array (out )
436
+ out = dpnp_array . _create_from_usm_ndarray (out )
441
437
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 (
444
440
type (out )
445
441
)
446
442
)
447
443
448
- dpnp .copyto (out , result )
444
+ dpnp .copyto (out , result , casting = "safe" )
449
445
450
446
return out
451
447
@@ -610,9 +606,9 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
610
606
611
607
Limitations
612
608
-----------
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 .
616
612
Input array data types are limited by supported DPNP :ref:`Data types`.
617
613
618
614
See Also
@@ -647,11 +643,11 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
647
643
648
644
if initial is not None :
649
645
raise NotImplementedError (
650
- "initial keyword arguemnts is only supported by its default value."
646
+ "initial keyword arguemnt is only supported by its default value."
651
647
)
652
648
elif where is not True :
653
649
raise NotImplementedError (
654
- "where keyword arguemnts is only supported by its default values."
650
+ "where keyword arguemnt is only supported by its default values."
655
651
)
656
652
else :
657
653
dpt_array = dpnp .get_usm_ndarray (a )
@@ -678,21 +674,17 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
678
674
raise ValueError (
679
675
f"Output array of shape { result .shape } is needed, got { out .shape } ."
680
676
)
681
- elif out .dtype != result .dtype :
682
- raise ValueError (
683
- f"Output array of type { result .dtype } is needed, got { out .dtype } ."
684
- )
685
677
elif not isinstance (out , dpnp_array ):
686
678
if isinstance (out , dpt .usm_ndarray ):
687
- out = dpnp . array (out )
679
+ out = dpnp_array . _create_from_usm_ndarray (out )
688
680
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 (
691
683
type (out )
692
684
)
693
685
)
694
686
695
- dpnp .copyto (out , result )
687
+ dpnp .copyto (out , result , casting = "safe" )
696
688
697
689
return out
698
690
0 commit comments