@@ -276,7 +276,7 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=N
276276 return call_origin (numpy .cov , m , y , rowvar , bias , ddof , fweights , aweights )
277277
278278
279- def max (input , axis = None , out = None ):
279+ def max (input , axis = None , out = None , keepdims = numpy . _NoValue , initial = numpy . _NoValue , where = numpy . _NoValue ):
280280 """
281281 Return the maximum of an array or maximum along an axis.
282282
@@ -300,33 +300,27 @@ def max(input, axis=None, out=None):
300300
301301 """
302302
303- dim_input = input .ndim
304-
305- is_input_dparray = isinstance (input , dparray )
306-
307- if not use_origin_backend (input ) and is_input_dparray :
308- if out is not None :
309- checker_throw_value_error ("max" , "out" , type (out ), None )
310-
311- result = dpnp_max (input , axis = axis )
312-
313- # scalar returned
314- if result .shape == (1 ,):
315- return result .dtype .type (result [0 ])
316-
317- return result
303+ if not use_origin_backend (input ):
304+ if not isinstance (input , dparray ):
305+ pass
306+ elif out is not None :
307+ pass
308+ elif keepdims is not numpy ._NoValue :
309+ pass
310+ elif initial is not numpy ._NoValue :
311+ pass
312+ elif where is not numpy ._NoValue :
313+ pass
314+ else :
315+ result = dpnp_max (input , axis = axis )
318316
319- input1 = dpnp .asnumpy (input ) if is_input_dparray else input
317+ # scalar returned
318+ if result .shape == (1 ,):
319+ return result .dtype .type (result [0 ])
320320
321- # TODO need to put dparray memory into NumPy call
322- result_numpy = numpy .max (input1 , axis = axis )
323- result = result_numpy
324- if isinstance (result , numpy .ndarray ):
325- result = dparray (result_numpy .shape , dtype = result_numpy .dtype )
326- for i in range (result .size ):
327- result ._setitem_scalar (i , result_numpy .item (i ))
321+ return result
328322
329- return result
323+ return call_origin ( numpy . max , input , axis , out , keepdims , initial , where )
330324
331325
332326def mean (a , axis = None , ** kwargs ):
@@ -433,7 +427,7 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False):
433427 return call_origin (numpy .median , a , axis , out , overwrite_input , keepdims )
434428
435429
436- def min (input , axis = None , out = None ):
430+ def min (input , axis = None , out = None , keepdims = numpy . _NoValue , initial = numpy . _NoValue , where = numpy . _NoValue ):
437431 """
438432 Return the minimum along a given axis.
439433
@@ -457,31 +451,27 @@ def min(input, axis=None, out=None):
457451
458452 """
459453
460- is_input_dparray = isinstance (input , dparray )
461-
462- if not use_origin_backend ( input ) and is_input_dparray :
463- if out is not None :
464- checker_throw_value_error ( "min" , "out" , type ( out ), None )
465-
466- result = dpnp_min ( input , axis = axis )
467-
468- # scalar returned
469- if result . shape == ( 1 ,) :
470- return result . dtype . type ( result [ 0 ])
471-
472- return result
454+ if not use_origin_backend (input ):
455+ if not isinstance ( input , dparray ):
456+ pass
457+ elif out is not None :
458+ pass
459+ elif keepdims is not numpy . _NoValue :
460+ pass
461+ elif initial is not numpy . _NoValue :
462+ pass
463+ elif where is not numpy . _NoValue :
464+ pass
465+ else :
466+ result = dpnp_min ( input , axis = axis )
473467
474- input1 = dpnp .asnumpy (input ) if is_input_dparray else input
468+ # scalar returned
469+ if result .shape == (1 ,):
470+ return result .dtype .type (result [0 ])
475471
476- # TODO need to put dparray memory into NumPy call
477- result_numpy = numpy .min (input1 , axis = axis )
478- result = result_numpy
479- if isinstance (result , numpy .ndarray ):
480- result = dparray (result_numpy .shape , dtype = result_numpy .dtype )
481- for i in range (result .size ):
482- result ._setitem_scalar (i , result_numpy .item (i ))
472+ return result
483473
484- return result
474+ return call_origin ( numpy . min , input , axis , out , keepdims , initial , where )
485475
486476
487477def std (a , axis = None , dtype = None , out = None , ddof = 0 , keepdims = numpy ._NoValue ):
0 commit comments