Skip to content

Commit cfcf613

Browse files
Update mathematical func docs adding broadcast info
1 parent 2debdca commit cfcf613

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

dpnp/dpnp_iface_mathematical.py

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ def _process_ediff1d_args(arg, arg_name, ary_dtype, ary_sycl_queue, usm_type):
428428
x2 : {dpnp.ndarray, usm_ndarray, scalar}
429429
Second input array, also expected to have numeric data type.
430430
Both inputs `x1` and `x2` can not be scalars at the same time.
431+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
432+
(which becomes the shape of the output).
431433
out : {None, dpnp.ndarray, usm_ndarray}, optional
432434
Output array to populate.
433435
Array must have the correct shape and the expected data type.
@@ -791,7 +793,7 @@ def convolve(a, v, mode="full"):
791793
return call_origin(numpy.convolve, a=a, v=v, mode=mode)
792794

793795

794-
_COPYSING_DOCSTRING = """
796+
_COPYSIGN_DOCSTRING = """
795797
Composes a floating-point value with the magnitude of `x1_i` and the sign of
796798
`x2_i` for each element of input arrays `x1` and `x2`.
797799
@@ -806,6 +808,8 @@ def convolve(a, v, mode="full"):
806808
Second input array, also expected to have a real floating-point data
807809
type.
808810
Both inputs `x1` and `x2` can not be scalars at the same time.
811+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
812+
(which becomes the shape of the output).
809813
out : {None, dpnp.ndarray, usm_ndarray}, optional
810814
Output array to populate.
811815
Array must have the correct shape and the expected data type.
@@ -852,7 +856,7 @@ def convolve(a, v, mode="full"):
852856
"copysign",
853857
ti._copysign_result_type,
854858
ti._copysign,
855-
_COPYSING_DOCSTRING,
859+
_COPYSIGN_DOCSTRING,
856860
)
857861

858862

@@ -1462,6 +1466,8 @@ def diff(a, n=1, axis=-1, prepend=None, append=None):
14621466
x2 : {dpnp.ndarray, usm_ndarray, scalar}
14631467
Second input array, also expected to have numeric data type.
14641468
Both inputs `x1` and `x2` can not be scalars at the same time.
1469+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1470+
(which becomes the shape of the output).
14651471
out : {None, dpnp.ndarray, usm_ndarray}, optional
14661472
Output array to populate.
14671473
Array must have the correct shape and the expected data type.
@@ -1759,6 +1765,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
17591765
x2 : {dpnp.ndarray, usm_ndarray, scalar}
17601766
Second input array, also expected to floating-point data types.
17611767
Both inputs `x1` and `x2` can not be scalars at the same time.
1768+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1769+
(which becomes the shape of the output).
17621770
out : {None, dpnp.ndarray, usm_ndarray}, optional
17631771
Output array to populate. Array must have the correct shape and
17641772
the expected data type.
@@ -1910,6 +1918,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
19101918
x2 : {dpnp.ndarray, usm_ndarray, scalar}
19111919
Second input array, also expected to have numeric data type.
19121920
Both inputs `x1` and `x2` can not be scalars at the same time.
1921+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1922+
(which becomes the shape of the output).
19131923
out : {None, dpnp.ndarray, usm_ndarray}, optional
19141924
Output array to populate.
19151925
Array must have the correct shape and the expected data type.
@@ -1984,6 +1994,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
19841994
x2 : {dpnp.ndarray, usm_ndarray, scalar}
19851995
Second input array, also expected to have numeric data type.
19861996
Both inputs `x1` and `x2` can not be scalars at the same time.
1997+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1998+
(which becomes the shape of the output).
19871999
out : {None, dpnp.ndarray, usm_ndarray}, optional
19882000
Output array to populate.
19892001
Array must have the correct shape and the expected data type.
@@ -2069,6 +2081,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
20692081
x2 : {dpnp.ndarray, usm_ndarray, scalar}
20702082
Second input array, also expected to have numeric data type.
20712083
Both inputs `x1` and `x2` can not be scalars at the same time.
2084+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2085+
(which becomes the shape of the output).
20722086
out : {None, dpnp.ndarray, usm_ndarray}, optional
20732087
Output array to populate.
20742088
Array must have the correct shape and the expected data type.
@@ -2151,6 +2165,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
21512165
x2 : {dpnp.ndarray, usm_ndarray, scalar}
21522166
Second input array, also expected to have a real-valued data type.
21532167
Both inputs `x1` and `x2` can not be scalars at the same time.
2168+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2169+
(which becomes the shape of the output).
21542170
out : {None, dpnp.ndarray, usm_ndarray}, optional
21552171
Output array to populate.
21562172
Array must have the correct shape and the expected data type.
@@ -2220,8 +2236,8 @@ def ediff1d(ary, to_end=None, to_begin=None):
22202236
x2 : {dpnp.ndarray, usm_ndarray, scalar}
22212237
Second input array, also expected to have an integer data type.
22222238
Both inputs `x1` and `x2` can not be scalars at the same time.
2223-
x : {dpnp.ndarray, usm_ndarray}
2224-
An array of floats to be rounded.
2239+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2240+
(which becomes the shape of the output).
22252241
out : {None, dpnp.ndarray, usm_ndarray}, optional
22262242
Output array to populate.
22272243
Array must have the correct shape and the expected data type.
@@ -2484,6 +2500,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
24842500
x2 : {dpnp.ndarray, usm_ndarray, scalar}
24852501
The value of the function when `x1` is ``0``.
24862502
Both inputs `x1` and `x2` can not be scalars at the same time.
2503+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2504+
(which becomes the shape of the output).
24872505
out : {None, dpnp.ndarray, usm_ndarray}, optional
24882506
Output array to populate.
24892507
Array must have the correct shape and the expected data type.
@@ -2576,7 +2594,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
25762594
Input array, expected to have numeric data type.
25772595
out : {None, dpnp.ndarray, usm_ndarray}, optional
25782596
Output array to populate.
2579-
Array must have the correct shape and the expected data type.
2597+
Array must have a shape that the input broadcast to and
2598+
the expected data type.
25802599
Default: ``None``.
25812600
order : {"C", "F", "A", "K"}, optional
25822601
Memory layout of the newly output array, if parameter `out` is ``None``.
@@ -2636,6 +2655,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
26362655
x2 : {dpnp.ndarray, usm_ndarray, scalar}
26372656
Second input array, also expected to have an integer data type.
26382657
Both inputs `x1` and `x2` can not be scalars at the same time.
2658+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2659+
(which becomes the shape of the output).
26392660
out : {None, dpnp.ndarray, usm_ndarray}, optional
26402661
Output array to populate.
26412662
Array must have the correct shape and the expected data type.
@@ -2693,6 +2714,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
26932714
x2 : {dpnp.ndarray, usm_ndarray, scalar}
26942715
Array of exponents of two, expected to have an integer data type.
26952716
Both inputs `x1` and `x2` can not be scalars at the same time.
2717+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2718+
(which becomes the shape of the output).
26962719
out : {None, dpnp.ndarray, usm_ndarray}, optional
26972720
Output array to populate. Array must have the correct shape and
26982721
the expected data type.
@@ -2758,6 +2781,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
27582781
x2 : {dpnp.ndarray, usm_ndarray, scalar}
27592782
Second input array, also expected to have numeric data type.
27602783
Both inputs `x1` and `x2` can not be scalars at the same time.
2784+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2785+
(which becomes the shape of the output).
27612786
out : {None, dpnp.ndarray, usm_ndarray}, optional
27622787
Output array to populate.
27632788
Array must have the correct shape and the expected data type.
@@ -2838,6 +2863,8 @@ def gradient(f, *varargs, axis=None, edge_order=1):
28382863
x2 : {dpnp.ndarray, usm_ndarray, scalar}
28392864
Second input array, also expected to have numeric data type.
28402865
Both inputs `x1` and `x2` can not be scalars at the same time.
2866+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2867+
(which becomes the shape of the output).s
28412868
out : {None, dpnp.ndarray, usm_ndarray}, optional
28422869
Output array to populate.
28432870
Array must have the correct shape and the expected data type.
@@ -2943,6 +2970,8 @@ def modf(x1, **kwargs):
29432970
x2 : {dpnp.ndarray, usm_ndarray, scalar}
29442971
Second input array, also expected to have numeric data type.
29452972
Both inputs `x1` and `x2` can not be scalars at the same time.
2973+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
2974+
(which becomes the shape of the output).
29462975
out : {None, dpnp.ndarray, usm_ndarray}, optional
29472976
Output array to populate.
29482977
Array must have the correct shape and the expected data type.
@@ -3205,6 +3234,8 @@ def nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):
32053234
x2 : {dpnp.ndarray, usm_ndarray, scalar}
32063235
The direction where to look for the next representable value of `x1`.
32073236
Both inputs `x1` and `x2` can not be scalars at the same time.
3237+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
3238+
(which becomes the shape of the output).
32083239
out : {None, dpnp.ndarray, usm_ndarray}, optional
32093240
Output array to populate. Array must have the correct shape and
32103241
the expected data type.
@@ -3326,6 +3357,8 @@ def nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):
33263357
x2 : {dpnp.ndarray, usm_ndarray, scalar}
33273358
Second input array, also expected to have numeric data type.
33283359
Both inputs `x1` and `x2` can not be scalars at the same time.
3360+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
3361+
(which becomes the shape of the output).
33293362
out : {None, dpnp.ndarray, usm_ndarray}, optional
33303363
Output array to populate. Array must have the correct shape and
33313364
the expected data type.
@@ -3688,6 +3721,8 @@ def real_if_close(a, tol=100):
36883721
x2 : {dpnp.ndarray, usm_ndarray, scalar}
36893722
Second input array, also expected to have a real-valued data type.
36903723
Both inputs `x1` and `x2` can not be scalars at the same time.
3724+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
3725+
(which becomes the shape of the output).
36913726
out : {None, dpnp.ndarray, usm_ndarray}, optional
36923727
Output array to populate.
36933728
Array must have the correct shape and the expected data type.
@@ -4114,6 +4149,8 @@ def real_if_close(a, tol=100):
41144149
x2 : {dpnp.ndarray, usm_ndarray, scalar}
41154150
Second input array, also expected to have numeric data type.
41164151
Both inputs `x1` and `x2` can not be scalars at the same time.
4152+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
4153+
(which becomes the shape of the output).
41174154
out : {None, dpnp.ndarray, usm_ndarray}, optional
41184155
Output array to populate.
41194156
Array must have the correct shape and the expected data type.

0 commit comments

Comments
 (0)