Skip to content

Commit 27eb063

Browse files
Merge pull request #1625 from IntelPython/accumulators-doc-edits
Docstring edits for accumulation functions
2 parents b1016bf + f4cd66a commit 27eb063

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

dpctl/tensor/_accumulation.py

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ def cumulative_sum(
288288
* If `x` has a boolean data type, the returned array will
289289
have the default signed integral type for the device
290290
where input array `x` is allocated.
291+
291292
If the data type (either specified or resolved) differs from the
292293
data type of `x`, the input array elements are cast to the
293294
specified data type before computing the cumulative sum.
@@ -302,13 +303,16 @@ def cumulative_sum(
302303
an array containing cumulative sums. The returned array has the data
303304
type as described in the `dtype` parameter description above.
304305
305-
Where `N` is the size of the axis the cumulative sums are computed
306-
along, the returned array shape is determined as follows.
307-
* If `include_initial` is `False`, the returned array will have the
308-
same shape as `x`.
309-
* If `include_initial` is `True`, the returned array will have the
310-
same shape as `x` except the axis along which the cumulative sum is
311-
calculated, which will have size `N+1`.
306+
The returned array shape is determined as follows:
307+
308+
* If `include_initial` is `False`, the returned array will
309+
have the same shape as `x`
310+
* If `include_initial` is `True`, the returned array will
311+
have the same shape as `x` except the axis along which the
312+
cumulative sum is calculated, which will have size `N+1`
313+
314+
where `N` is the size of the axis the cumulative sums are computed
315+
along.
312316
"""
313317
return _accumulate_common(
314318
x,
@@ -355,27 +359,32 @@ def cumulative_prod(
355359
* If `x` has a boolean data type, the returned array will
356360
have the default signed integral type for the device
357361
where input array `x` is allocated.
362+
358363
If the data type (either specified or resolved) differs from the
359364
data type of `x`, the input array elements are cast to the
360365
specified data type before computing the cumulative product.
361366
Default: `None`.
362367
include_initial (bool):
363368
boolean indicating whether to include the initial value (i.e., the
364-
additive identity, zero) as the first value along the provided axis
365-
in the output. Default: `False`.
369+
additive identity, zero) as the first value along the provided
370+
axis in the output. Default: `False`.
366371
367372
Returns:
368373
usm_ndarray:
369-
an array containing cumulative products. The returned array has the
370-
data type as described in the `dtype` parameter description above.
371-
372-
Where `N` is the size of the axis the cumulative products are
373-
computed along, the returned array shape is determined as follows.
374-
* If `include_initial` is `False`, the returned array will have the
375-
same shape as `x`.
376-
* If `include_initial` is `True`, the returned array will have the
377-
same shape as `x` except the axis along which the cumulative product
378-
is calculated, which will have size `N+1`.
374+
an array containing cumulative products. The returned array has
375+
the data type as described in the `dtype` parameter description
376+
above.
377+
378+
The returned array shape is determined as follows:
379+
380+
* If `include_initial` is `False`, the returned array will
381+
have the same shape as `x`
382+
* If `include_initial` is `True`, the returned array will
383+
have the same shape as `x` except the axis along which the
384+
cumulative product is calculated, which will have size `N+1`
385+
386+
where `N` is the size of the axis the cumulative products are
387+
computed along.
379388
"""
380389
return _accumulate_common(
381390
x,
@@ -422,6 +431,7 @@ def cumulative_logsumexp(
422431
* If `x` has a boolean data type, the returned array will
423432
have the default signed integral type for the device
424433
where input array `x` is allocated.
434+
425435
If the data type (either specified or resolved) differs from the
426436
data type of `x`, the input array elements are cast to the
427437
specified data type before computing the cumulative logsumexp.
@@ -433,18 +443,18 @@ def cumulative_logsumexp(
433443
434444
Returns:
435445
usm_ndarray:
436-
an array containing cumulative logsumexp results. The returned array
437-
has the data type as described in the `dtype` parameter description
438-
above.
439-
440-
Where `N` is the size of the axis the cumulative logsumexp results
441-
are computed along, the returned array shape is determined as
442-
follows.
443-
* If `include_initial` is `False`, the returned array will have the
444-
same shape as `x`.
445-
* If `include_initial` is `True`, the returned array will have the
446-
same shape as `x` except the axis along which the cumulative
447-
logsumexp is calculated, which will have size `N+1`.
446+
an array containing cumulative logsumexp results. The returned
447+
array has the data type as described in the `dtype` parameter
448+
description above.
449+
450+
The returned array shape is determined as follows:
451+
452+
* If `include_initial` is `False`, the returned array will
453+
have the same shape as `x`
454+
* If `include_initial` is `True`, the returned array will
455+
have the same shape as `x` except the axis along which the
456+
cumulative logsumexp is calculated, which will have size
457+
`N+1`
448458
"""
449459
return _accumulate_common(
450460
x,

0 commit comments

Comments
 (0)