@@ -410,23 +410,10 @@ def max(a, axis=None, out=None, keepdims=False, initial=None, where=True):
410
410
)
411
411
else :
412
412
dpt_array = dpnp .get_usm_ndarray (a )
413
- if dpt_array .size == 0 :
414
- # TODO: get rid of this if condition when dpctl supports it
415
- axis = (axis ,) if isinstance (axis , int ) else axis
416
- for i in range (a .ndim ):
417
- if a .shape [i ] == 0 :
418
- if axis is None or i in axis :
419
- raise ValueError (
420
- "reduction does not support zero-size arrays"
421
- )
422
- else :
423
- indices = [i for i in range (a .ndim ) if i not in axis ]
424
- res_shape = tuple ([a .shape [i ] for i in indices ])
425
- result = dpnp .empty (res_shape , dtype = a .dtype )
426
- else :
427
- result = dpnp_array ._create_from_usm_ndarray (
428
- dpt .max (dpt_array , axis = axis , keepdims = keepdims )
429
- )
413
+ result = dpnp_array ._create_from_usm_ndarray (
414
+ dpt .max (dpt_array , axis = axis , keepdims = keepdims )
415
+ )
416
+
430
417
if out is None :
431
418
return result
432
419
else :
@@ -655,22 +642,10 @@ def min(a, axis=None, out=None, keepdims=False, initial=None, where=True):
655
642
)
656
643
else :
657
644
dpt_array = dpnp .get_usm_ndarray (a )
658
- if dpt_array .size == 0 :
659
- # TODO: get rid of this if condition when dpctl supports it
660
- for i in range (a .ndim ):
661
- if a .shape [i ] == 0 :
662
- if axis is None or i in axis :
663
- raise ValueError (
664
- "reduction does not support zero-size arrays"
665
- )
666
- else :
667
- indices = [i for i in range (a .ndim ) if i not in axis ]
668
- res_shape = tuple ([a .shape [i ] for i in indices ])
669
- result = dpnp .empty (res_shape , dtype = a .dtype )
670
- else :
671
- result = dpnp_array ._create_from_usm_ndarray (
672
- dpt .min (dpt_array , axis = axis , keepdims = keepdims )
673
- )
645
+ result = dpnp_array ._create_from_usm_ndarray (
646
+ dpt .min (dpt_array , axis = axis , keepdims = keepdims )
647
+ )
648
+
674
649
if out is None :
675
650
return result
676
651
else :
0 commit comments