@@ -1163,8 +1163,8 @@ def cumsum(a, axis=None, dtype=None, out=None):
11631163 [4, 5, 6]])
11641164 >>> np.cumsum(a)
11651165 array([ 1, 3, 6, 10, 15, 21])
1166- >>> np.cumsum(a, dtype=float ) # specifies type of output value(s)
1167- array([ 1., 3., 6., 10., 15., 21.])
1166+ >>> np.cumsum(a, dtype=np.float32 ) # specifies type of output value(s)
1167+ array([ 1., 3., 6., 10., 15., 21.], dtype=np.float32 )
11681168
11691169 >>> np.cumsum(a, axis=0) # sum over rows for each of the 3 columns
11701170 array([[1, 2, 3],
@@ -1175,8 +1175,8 @@ def cumsum(a, axis=None, dtype=None, out=None):
11751175
11761176 ``cumsum(b)[-1]`` may not be equal to ``sum(b)``
11771177
1178- >>> b = np.array([1, 2e-9 , 3e-9 ] * 10000 )
1179- >>> b.cumsum().dtype == b.sum().dtype == np.float64
1178+ >>> b = np.array([1, 2e-7 , 3e-7 ] * 100000, dtype=np.float32 )
1179+ >>> b.cumsum().dtype == b.sum().dtype == np.float32
11801180 True
11811181 >>> b.cumsum()[-1] == b.sum()
11821182 array(False)
@@ -1208,16 +1208,16 @@ def cumulative_prod(
12081208
12091209 This function is an Array API compatible alternative to :obj:`dpnp.cumprod`.
12101210
1211- For full documentation refer to :obj:`numpy.cumprod `.
1211+ For full documentation refer to :obj:`numpy.cumulative_prod `.
12121212
12131213 Parameters
12141214 ----------
12151215 x : {dpnp.ndarray, usm_ndarray}
12161216 Input array.
12171217 axis : {None, int}, optional
1218- Axis along which the cumulative product is computed. The default
1219- (``None``) is only allowed for one-dimensional arrays. For arrays
1220- with more than one dimension `axis` is required.
1218+ Axis along which the cumulative product is computed. The default value
1219+ is only allowed for one-dimensional arrays. For arrays with more than
1220+ one dimension `axis` is required.
12211221 Default: ``None``.
12221222 dtype : {None, dtype}, optional
12231223 Type of the returned array and of the accumulator in which the elements
@@ -1262,13 +1262,13 @@ def cumulative_prod(
12621262 The cumulative product for each column (i.e., over the rows) of `b`:
12631263
12641264 >>> b = np.array([[1, 2, 3], [4, 5, 6]])
1265- >>> np.cumulative_prod(a , axis=0)
1265+ >>> np.cumulative_prod(b , axis=0)
12661266 array([[ 1, 2, 3],
12671267 [ 4, 10, 18]])
12681268
12691269 The cumulative product for each row (i.e. over the columns) of `b`:
12701270
1271- >>> np.cumulative_prod(a , axis=1)
1271+ >>> np.cumulative_prod(b , axis=1)
12721272 array([[ 1, 2, 6],
12731273 [ 4, 20, 120]])
12741274
@@ -1294,14 +1294,14 @@ def cumulative_sum(
12941294
12951295 This function is an Array API compatible alternative to :obj:`dpnp.cumsum`.
12961296
1297- For full documentation refer to :obj:`numpy.cumsum `.
1297+ For full documentation refer to :obj:`numpy.cumulative_sum `.
12981298
12991299 Parameters
13001300 ----------
13011301 x : {dpnp.ndarray, usm_ndarray}
13021302 Input array.
13031303 axis : {None, int}, optional
1304- Axis along which the cumulative sum is computed. The default (``None``)
1304+ Axis along which the cumulative sum is computed. The default value
13051305 is only allowed for one-dimensional arrays. For arrays with more than
13061306 one dimension `axis` is required.
13071307 Default: ``None``.
@@ -1345,21 +1345,21 @@ def cumulative_sum(
13451345 array([1, 2, 3, 4, 5, 6])
13461346 >>> np.cumulative_sum(a)
13471347 array([ 1, 3, 6, 10, 15, 21])
1348- >>> np.cumulative_sum(a, dtype=float ) # specifies type of output value(s)
1349- array([ 1., 3., 6., 10., 15., 21.])
1348+ >>> np.cumulative_sum(a, dtype=np.float32 ) # specifies output dtype
1349+ array([ 1., 3., 6., 10., 15., 21.], dtype=np.float32 )
13501350
13511351 >>> b = np.array([[1, 2, 3], [4, 5, 6]])
1352- >>> np.cumsum (b, axis=0) # sum over rows for each of the 3 columns
1352+ >>> np.cumulative_sum (b, axis=0) # sum over rows for each of the 3 columns
13531353 array([[1, 2, 3],
13541354 [5, 7, 9]])
1355- >>> np.cumsum (b, axis=1) # sum over columns for each of the 2 rows
1355+ >>> np.cumulative_sum (b, axis=1) # sum over columns for each of the 2 rows
13561356 array([[ 1, 3, 6],
13571357 [ 4, 9, 15]])
13581358
13591359 ``cumulative_sum(c)[-1]`` may not be equal to ``sum(c)``
13601360
1361- >>> c = np.array([1, 2e-9 , 3e-9 ] * 1000000 )
1362- >>> np.cumulative_sum(c).dtype == c.sum().dtype == np.float64
1361+ >>> c = np.array([1, 2e-7 , 3e-7 ] * 100000, dtype=np.float32 )
1362+ >>> np.cumulative_sum(c).dtype == c.sum().dtype == np.float32
13631363 True
13641364 >>> np.cumulative_sum(c)[-1] == c.sum()
13651365 array(False)
0 commit comments