Add dtype test
@@ -118,6 +118,12 @@ class TestSumprod(unittest.TestCase):
a = testing.shaped_arange((20, 30, 40, 50), xp, dtype)
return a.sum(axis=(0, 2, 3))
+ @testing.for_all_dtypes_combination(names=['src_dtype', 'dst_dtype'])
+ @testing.numpy_cupy_allclose()
+ def test_sum_dtype(self, xp, src_dtype, dst_dtype):
+ a = testing.shaped_arange((2, 3, 4), xp, src_dtype)
+ return a.sum(dtype=dst_dtype)
+
@testing.numpy_cupy_allclose()
def test_sum_keepdims(self, xp):
a = testing.shaped_arange((2, 3, 4), xp)
@@ -161,6 +167,12 @@ class TestSumprod(unittest.TestCase):
a = testing.shaped_arange((2, 3, 4), xp, dtype)
return xp.prod(a, axis=1)
+ @testing.for_all_dtypes_combination(names=['src_dtype', 'dst_dtype'])
+ @testing.numpy_cupy_allclose()
+ def test_prod_dtype(self, xp, src_dtype, dst_dtype):
+ a = testing.shaped_arange((2, 3, 4), xp, src_dtype)
+ return a.prod(dtype=dst_dtype)
+
axes = [0, 1, 2]
