@@ -319,13 +319,6 @@ def can_cast(from_: Union[Dtype, array], to: Dtype, /) -> bool:
319
319
}
320
320
return can_cast_dict [from_ ][to ]
321
321
322
- def test_bitwise_or (x : array , y : array ):
323
- if not paddle .is_tensor (x ):
324
- x = paddle .to_tensor (x )
325
- if not paddle .is_tensor (y ):
326
- y = paddle .to_tensor (y )
327
- return paddle .bitwise_or (x , y )
328
-
329
322
# Basic renames
330
323
bitwise_invert = paddle .bitwise_not
331
324
newaxis = None
@@ -339,7 +332,7 @@ def test_bitwise_or(x: array, y: array):
339
332
atan2 = _two_arg (paddle .atan2 )
340
333
bitwise_and = _two_arg (paddle .bitwise_and )
341
334
bitwise_left_shift = _two_arg (paddle .bitwise_left_shift )
342
- bitwise_or = _two_arg (test_bitwise_or )
335
+ bitwise_or = _two_arg (paddle . bitwise_or )
343
336
bitwise_right_shift = _two_arg (paddle .bitwise_right_shift )
344
337
bitwise_xor = _two_arg (paddle .bitwise_xor )
345
338
copysign = _two_arg (paddle .copysign )
@@ -527,6 +520,9 @@ def prod(
527
520
dtype = _NP_2_PADDLE_DTYPE [dtype .name ]
528
521
529
522
if axis == ():
523
+ # We can't upcast uint8 according to the spec because there is no
524
+ # paddle.uint64, so at least upcast to int64 which is what sum does
525
+ # when axis=None.
530
526
if dtype is None :
531
527
if x .dtype in [paddle .int8 , paddle .int16 , paddle .int32 , paddle .uint8 ]:
532
528
return x .to (paddle .int64 )
@@ -537,8 +533,10 @@ def prod(
537
533
return _reduce_multiple_axes (
538
534
paddle .prod , x , axis , keepdim = keepdims , dtype = dtype , ** kwargs
539
535
)
540
-
536
+
537
+
541
538
if axis is None :
539
+ # paddle.prod doesn't support multiple axes
542
540
if dtype is None and x .dtype == paddle .int32 :
543
541
dtype = 'int64'
544
542
res = paddle .prod (x , dtype = dtype , ** kwargs )
0 commit comments