Skip to content

Commit 57fc540

Browse files
Update trigonometric func docs adding broadcast info
1 parent 5c82478 commit 57fc540

File tree

1 file changed

+78
-49
lines changed

1 file changed

+78
-49
lines changed

dpnp/dpnp_iface_trigonometric.py

+78-49
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
122122
Input array, expected to have numeric data type.
123123
out : {None, dpnp.ndarray, usm_ndarray}, optional
124124
Output array to populate.
125-
Array must have the correct shape and the expected data type.
125+
Array must have a shape that the input broadcast to and
126+
the expected data type.
126127
Default: ``None``.
127128
order : {"C", "F", "A", "K"}, optional
128129
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -198,7 +199,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
198199
Input array, expected to have numeric data type.
199200
out : {None, dpnp.ndarray, usm_ndarray}, optional
200201
Output array to populate.
201-
Array must have the correct shape and the expected data type.
202+
Array must have a shape that the input broadcast to and
203+
the expected data type.
202204
Default: ``None``.
203205
order : {"C", "F", "A", "K"}, optional
204206
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -275,7 +277,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
275277
Input array, expected to have numeric data type.
276278
out : {None, dpnp.ndarray, usm_ndarray}, optional
277279
Output array to populate.
278-
Array must have the correct shape and the expected data type.
280+
Array must have a shape that the input broadcast to and
281+
the expected data type.
279282
Default: ``None``.
280283
order : {"C", "F", "A", "K"}, optional
281284
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -354,7 +357,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
354357
Input array, expected to have numeric data type.
355358
out : {None, dpnp.ndarray, usm_ndarray}, optional
356359
Output array to populate.
357-
Array must have the correct shape and the expected data type.
360+
Array must have a shape that the input broadcast to and
361+
the expected data type.
358362
Default: ``None``.
359363
order : {"C", "F", "A", "K"}, optional
360364
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -431,7 +435,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
431435
Input array, expected to have numeric data type.
432436
out : {None, dpnp.ndarray, usm_ndarray}, optional
433437
Output array to populate.
434-
Array must have the correct shape and the expected data type.
438+
Array must have a shape that the input broadcast to and
439+
the expected data type.
435440
Default: ``None``.
436441
order : {"C", "F", "A", "K"}, optional
437442
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -516,9 +521,12 @@ def _get_accumulation_res_dt(a, dtype, _out):
516521
Second input array, also expected to have a real-valued
517522
floating-point data type.
518523
Both inputs `x1` and `x2` can not be scalars at the same time.
524+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
525+
(which becomes the shape of the output).
519526
out : {None, dpnp.ndarray, usm_ndarray}, optional
520527
Output array to populate.
521-
Array must have the correct shape and the expected data type.
528+
Array must have a shape that the inputs broadcast to and
529+
the expected data type.
522530
Default: ``None``.
523531
order : {"C", "F", "A", "K"}, optional
524532
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -591,7 +599,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
591599
Input array, expected to have numeric data type.
592600
out : {None, dpnp.ndarray, usm_ndarray}, optional
593601
Output array to populate.
594-
Array must have the correct shape and the expected data type.
602+
Array must have a shape that the input broadcast to and
603+
the expected data type.
595604
Default: ``None``.
596605
order : {"C", "F", "A", "K"}, optional
597606
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -664,7 +673,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
664673
Input array, expected to have a real-valued data type.
665674
out : {None, dpnp.ndarray, usm_ndarray}, optional
666675
Output array to populate.
667-
Array must have the correct shape and the expected data type.
676+
Array must have a shape that the input broadcast to and
677+
the expected data type.
668678
Default: ``None``.
669679
order : {"C", "F", "A", "K"}, optional
670680
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -716,7 +726,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
716726
Input array, expected to have numeric data type.
717727
out : {None, dpnp.ndarray, usm_ndarray}, optional
718728
Output array to populate.
719-
Array must have the correct shape and the expected data type.
729+
Array must have a shape that the input broadcast to and
730+
the expected data type.
720731
Default: ``None``.
721732
order : {"C", "F", "A", "K"}, optional
722733
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -770,7 +781,8 @@ def _get_accumulation_res_dt(a, dtype, _out):
770781
Input array, expected to have numeric data type.
771782
out : {None, dpnp.ndarray, usm_ndarray}, optional
772783
Output array to populate.
773-
Array must have the correct shape and the expected data type.
784+
Array must have a shape that the input broadcast to and
785+
the expected data type.
774786
Default: ``None``.
775787
order : {"C", "F", "A", "K"}, optional
776788
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -913,7 +925,8 @@ def cumlogsumexp(
913925
Angles in degrees.
914926
out : {None, dpnp.ndarray, usm_ndarray}, optional
915927
Output array to populate.
916-
Array must have the correct shape and the expected data type.
928+
Array must have a shape that the input broadcast to and
929+
the expected data type.
917930
Default: ``None``.
918931
order : {"C", "F", "A", "K"}, optional
919932
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -968,7 +981,8 @@ def cumlogsumexp(
968981
Input array in radians.
969982
out : {None, dpnp.ndarray, usm_ndarray}, optional
970983
Output array to populate.
971-
Array must have the correct shape and the expected data type.
984+
Array must have a shape that the input broadcast to and
985+
the expected data type.
972986
Default: ``None``.
973987
order : {"C", "F", "A", "K"}, optional
974988
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1026,7 +1040,8 @@ def cumlogsumexp(
10261040
Input array, expected to have numeric data type.
10271041
out : {None, dpnp.ndarray, usm_ndarray}, optional
10281042
Output array to populate.
1029-
Array must have the correct shape and the expected data type.
1043+
Array must have a shape that the input broadcast to and
1044+
the expected data type.
10301045
Default: ``None``.
10311046
order : {"C", "F", "A", "K"}, optional
10321047
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1079,7 +1094,8 @@ def cumlogsumexp(
10791094
Input array, expected to have a floating-point data type.
10801095
out : {None, dpnp.ndarray, usm_ndarray}, optional
10811096
Output array to populate.
1082-
Array must have the correct shape and the expected data type.
1097+
Array must have a shape that the input broadcast to and
1098+
the expected data type.
10831099
Default: ``None``.
10841100
order : {"C", "F", "A", "K"}, optional
10851101
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1135,7 +1151,8 @@ def cumlogsumexp(
11351151
Input array, expected to have numeric data type.
11361152
out : {None, dpnp.ndarray, usm_ndarray}, optional
11371153
Output array to populate.
1138-
Array must have the correct shape and the expected data type.
1154+
Array must have a shape that the input broadcast to and
1155+
the expected data type.
11391156
Default: ``None``.
11401157
order : {"C", "F", "A", "K"}, optional
11411158
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1192,15 +1209,15 @@ def cumlogsumexp(
11921209
11931210
Parameters
11941211
----------
1195-
x1 : {dpnp.ndarray, usm_ndarray, scalar}
1196-
First input array, expected to have a real-valued data type.
1197-
Both inputs `x1` and `x2` can not be scalars at the same time.
1198-
x2 : {dpnp.ndarray, usm_ndarray, scalar}
1199-
Second input array, also expected to have a real-valued data type.
1212+
x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1213+
Input arrays, expected to have a real-valued data type.
12001214
Both inputs `x1` and `x2` can not be scalars at the same time.
1215+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1216+
(which becomes the shape of the output).
12011217
out : {None, dpnp.ndarray, usm_ndarray}, optional
12021218
Output array to populate.
1203-
Array must have the correct shape and the expected data type.
1219+
Array must have a shape that the inputs broadcast to and
1220+
the expected data type.
12041221
Default: ``None``.
12051222
order : {"C", "F", "A", "K"}, optional
12061223
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1261,7 +1278,8 @@ def cumlogsumexp(
12611278
Input array, expected to have numeric data type.
12621279
out : {None, dpnp.ndarray, usm_ndarray}, optional
12631280
Output array to populate.
1264-
Array must have the correct shape and the expected data type.
1281+
Array must have a shape that the input broadcast to and
1282+
the expected data type.
12651283
Default: ``None``.
12661284
order : {"C", "F", "A", "K"}, optional
12671285
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1316,7 +1334,8 @@ def cumlogsumexp(
13161334
Input array, expected to have numeric data type.
13171335
out : {None, dpnp.ndarray, usm_ndarray}, optional
13181336
Output array to populate.
1319-
Array must have the correct shape and the expected data type.
1337+
Array must have a shape that the input broadcast to and
1338+
the expected data type.
13201339
Default: ``None``.
13211340
order : {"C", "F", "A", "K"}, optional
13221341
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1376,7 +1395,8 @@ def cumlogsumexp(
13761395
Input array, expected to have numeric data type.
13771396
out : {None, dpnp.ndarray, usm_ndarray}, optional
13781397
Output array to populate.
1379-
Array must have the correct shape and the expected data type.
1398+
Array must have a shape that the input broadcast to and
1399+
the expected data type.
13801400
Default: ``None``.
13811401
order : {"C", "F", "A", "K"}, optional
13821402
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1436,7 +1456,8 @@ def cumlogsumexp(
14361456
Input array, expected to have numeric data type.
14371457
out : {None, dpnp.ndarray, usm_ndarray}, optional
14381458
Output array to populate.
1439-
Array must have the correct shape and the expected data type.
1459+
Array must have a shape that the input broadcast to and
1460+
the expected data type.
14401461
Default: ``None``.
14411462
order : {"C", "F", "A", "K"}, optional
14421463
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1495,17 +1516,16 @@ def cumlogsumexp(
14951516
14961517
Parameters
14971518
----------
1498-
x1 : {dpnp.ndarray, usm_ndarray, scalar}
1499-
First input array, expected to have a real-valued floating-point
1519+
x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1520+
Input arrays, expected to have a real-valued floating-point
15001521
data type.
15011522
Both inputs `x1` and `x2` can not be scalars at the same time.
1502-
x2 : {dpnp.ndarray, usm_ndarray, scalar}
1503-
Second input array, also expected to have a real-valued
1504-
floating-point data type.
1505-
Both inputs `x1` and `x2` can not be scalars at the same time.
1523+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1524+
(which becomes the shape of the output).
15061525
out : {None, dpnp.ndarray, usm_ndarray}, optional
15071526
Output array to populate.
1508-
Array must have the correct shape and the expected data type.
1527+
Array must have a shape that the inputs broadcast to and
1528+
the expected data type.
15091529
Default: ``None``.
15101530
order : {"C", "F", "A", "K"}, optional
15111531
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1567,17 +1587,16 @@ def cumlogsumexp(
15671587
15681588
Parameters
15691589
----------
1570-
x1 : {dpnp.ndarray, usm_ndarray, scalar}
1571-
First input array, expected to have a real-valued floating-point
1590+
x1, x2 : {dpnp.ndarray, usm_ndarray, scalar}
1591+
Input arrays, expected to have a real-valued floating-point
15721592
data type.
15731593
Both inputs `x1` and `x2` can not be scalars at the same time.
1574-
x2 : {dpnp.ndarray, usm_ndarray, scalar}
1575-
Second input array, also expected to have a real-valued
1576-
floating-point data type.
1577-
Both inputs `x1` and `x2` can not be scalars at the same time.
1594+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1595+
(which becomes the shape of the output).
15781596
out : {None, dpnp.ndarray, usm_ndarray}, optional
15791597
Output array to populate.
1580-
Array must have the correct shape and the expected data type.
1598+
Array must have a shape that the inputs broadcast to and
1599+
the expected data type.
15811600
Default: ``None``.
15821601
order : {"C", "F", "A", "K"}, optional
15831602
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1719,7 +1738,8 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
17191738
Angle in radians.
17201739
out : {None, dpnp.ndarray, usm_ndarray}, optional
17211740
Output array to populate.
1722-
Array must have the correct shape and the expected data type.
1741+
Array must have a shape that the input broadcast to and
1742+
the expected data type.
17231743
Default: ``None``.
17241744
order : {"C", "F", "A", "K"}, optional
17251745
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1774,7 +1794,8 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
17741794
Input array in degrees.
17751795
out : {None, dpnp.ndarray, usm_ndarray}, optional
17761796
Output array to populate.
1777-
Array must have the correct shape and the expected data type.
1797+
Array must have a shape that the input broadcast to and
1798+
the expected data type.
17781799
Default: ``None``.
17791800
order : {"C", "F", "A", "K"}, optional
17801801
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1833,7 +1854,8 @@ def logsumexp(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
18331854
Input array, expected to have a real-valued floating-point data type.
18341855
out : {None, dpnp.ndarray, usm_ndarray}, optional
18351856
Output array to populate.
1836-
Array must have the correct shape and the expected data type.
1857+
Array must have a shape that the input broadcast to and
1858+
the expected data type.
18371859
Default: ``None``.
18381860
order : {"C", "F", "A", "K"}, optional
18391861
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -1964,7 +1986,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
19641986
Input array, expected to have a real floating-point data type.
19651987
out : ({None, dpnp.ndarray, usm_ndarray}, optional):
19661988
Output array to populate.
1967-
Array must have the correct shape and the expected data type.
1989+
Array must have a shape that the input broadcast to and
1990+
the expected data type.
19681991
Default: ``None``.
19691992
order : ({'C', 'F', 'A', 'K'}, optional):
19701993
Memory layout of the newly output array, if parameter `out` is `None`.
@@ -2015,7 +2038,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
20152038
Input array, expected to have numeric data type.
20162039
out : {None, dpnp.ndarray, usm_ndarray}, optional
20172040
Output array to populate.
2018-
Array must have the correct shape and the expected data type.
2041+
Array must have a shape that the input broadcast to and
2042+
the expected data type.
20192043
Default: ``None``.
20202044
order : {"C", "F", "A", "K"}, optional
20212045
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2069,7 +2093,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
20692093
Input array, expected to have numeric data type.
20702094
out : {None, dpnp.ndarray, usm_ndarray}, optional
20712095
Output array to populate.
2072-
Array must have the correct shape and the expected data type.
2096+
Array must have a shape that the input broadcast to and
2097+
the expected data type.
20732098
Default: ``None``.
20742099
order : {"C", "F", "A", "K"}, optional
20752100
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2122,7 +2147,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
21222147
Input array.
21232148
out : {None, dpnp.ndarray, usm_ndarray}, optional
21242149
Output array to populate.
2125-
Array must have the correct shape and the expected data type.
2150+
Array must have a shape that the input broadcast to and
2151+
the expected data type.
21262152
Default: ``None``.
21272153
order : {"C", "F", "A", "K"}, optional
21282154
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2178,7 +2204,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
21782204
Input array.
21792205
out : {None, dpnp.ndarray, usm_ndarray}, optional
21802206
Output array to populate.
2181-
Array must have the correct shape and the expected data type.
2207+
Array must have a shape that the input broadcast to and
2208+
the expected data type.
21822209
Default: ``None``.
21832210
order : {"C", "F", "A", "K"}, optional
21842211
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2233,7 +2260,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
22332260
Input array, expected to have numeric data type.
22342261
out : {None, dpnp.ndarray, usm_ndarray}, optional
22352262
Output array to populate.
2236-
Array must have the correct shape and the expected data type.
2263+
Array must have a shape that the input broadcast to and
2264+
the expected data type.
22372265
Default: ``None``.
22382266
order : {"C", "F", "A", "K"}, optional
22392267
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2287,7 +2315,8 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
22872315
Input array, expected to have numeric data type.
22882316
out : {None, dpnp.ndarray, usm_ndarray}, optional
22892317
Output array to populate.
2290-
Array must have the correct shape and the expected data type.
2318+
Array must have a shape that the input broadcast to and
2319+
the expected data type.
22912320
Default: ``None``.
22922321
order : {"C", "F", "A", "K"}, optional
22932322
Memory layout of the newly output array, if parameter `out` is ``None``.

0 commit comments

Comments
 (0)