@@ -389,42 +389,6 @@ def nonzero(x: ndarray, /, xp, **kwargs) -> Tuple[ndarray, ...]:
389
389
raise ValueError ("nonzero() does not support zero-dimensional arrays" )
390
390
return xp .nonzero (x , ** kwargs )
391
391
392
- # sum() and prod() should always upcast when dtype=None
393
- def sum (
394
- x : ndarray ,
395
- / ,
396
- xp ,
397
- * ,
398
- axis : Optional [Union [int , Tuple [int , ...]]] = None ,
399
- dtype : Optional [Dtype ] = None ,
400
- keepdims : bool = False ,
401
- ** kwargs ,
402
- ) -> ndarray :
403
- # `xp.sum` already upcasts integers, but not floats or complexes
404
- if dtype is None :
405
- if x .dtype == xp .float32 :
406
- dtype = xp .float64
407
- elif x .dtype == xp .complex64 :
408
- dtype = xp .complex128
409
- return xp .sum (x , axis = axis , dtype = dtype , keepdims = keepdims , ** kwargs )
410
-
411
- def prod (
412
- x : ndarray ,
413
- / ,
414
- xp ,
415
- * ,
416
- axis : Optional [Union [int , Tuple [int , ...]]] = None ,
417
- dtype : Optional [Dtype ] = None ,
418
- keepdims : bool = False ,
419
- ** kwargs ,
420
- ) -> ndarray :
421
- if dtype is None :
422
- if x .dtype == xp .float32 :
423
- dtype = xp .float64
424
- elif x .dtype == xp .complex64 :
425
- dtype = xp .complex128
426
- return xp .prod (x , dtype = dtype , axis = axis , keepdims = keepdims , ** kwargs )
427
-
428
392
# ceil, floor, and trunc return integers for integer inputs
429
393
430
394
def ceil (x : ndarray , / , xp , ** kwargs ) -> ndarray :
@@ -525,6 +489,6 @@ def isdtype(
525
489
'linspace' , 'ones' , 'ones_like' , 'zeros' , 'zeros_like' ,
526
490
'UniqueAllResult' , 'UniqueCountsResult' , 'UniqueInverseResult' ,
527
491
'unique_all' , 'unique_counts' , 'unique_inverse' , 'unique_values' ,
528
- 'astype' , 'std' , 'var' , 'clip' , 'permute_dims' , 'reshape' , 'argsort' ,
529
- 'sort ' , 'nonzero ' , 'sum ' , 'prod ' , 'ceil ' , 'floor ' , 'trunc ' ,
530
- 'matmul' , ' matrix_transpose' , 'tensordot' , 'vecdot' , 'isdtype' ]
492
+ 'astype' , 'std' , 'var' , 'clip' , 'permute_dims' , 'reshape' ,
493
+ 'argsort ' , 'sort ' , 'nonzero ' , 'ceil ' , 'floor ' , 'trunc ' , 'matmul ' ,
494
+ 'matrix_transpose' , 'tensordot' , 'vecdot' , 'isdtype' ]
0 commit comments