Skip to content

Commit 237a5f1

Browse files
committed
address comments
1 parent c26870e commit 237a5f1

File tree

2 files changed

+24
-66
lines changed

2 files changed

+24
-66
lines changed

dpnp/dpnp_array.py

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,39 +1054,7 @@ def ravel(self, order="C"):
10541054
"""
10551055
Return a contiguous flattened array.
10561056
1057-
For full documentation refer to :obj:`numpy.ndarray.ravel`.
1058-
1059-
Parameters
1060-
----------
1061-
order : {'C', 'F'}, optional
1062-
The elements of a are read using this index order. ``C`` means to index
1063-
the elements in row-major, C-style order, with the last axis index
1064-
changing fastest, back to the first axis index changing slowest. ``F``
1065-
means to index the elements in column-major, Fortran-style order, with
1066-
the first index changing fastest, and the last index changing slowest.
1067-
By default, ``C`` index order is used.
1068-
1069-
Returns
1070-
-------
1071-
y : dpnp_array
1072-
`y` is a contiguous 1-D array of the same subtype as a, with shape (a.size,)
1073-
1074-
See Also
1075-
--------
1076-
:obj:`dpnp.reshape` : Change the shape of an array without changing its data.
1077-
1078-
Examples
1079-
--------
1080-
>>> import dpnp as np
1081-
>>> x = np.array([[1, 2, 3], [4, 5, 6]])
1082-
>>> x.ravel()
1083-
array([1, 2, 3, 4, 5, 6])
1084-
1085-
>>> x.reshape(-1)
1086-
array([1, 2, 3, 4, 5, 6])
1087-
1088-
>>> x.ravel(order='F')
1089-
array([1, 4, 2, 5, 3, 6])
1057+
For full documentation refer to :obj:`dpnp.ravel`.
10901058
10911059
"""
10921060

@@ -1131,28 +1099,7 @@ def repeat(self, repeats, axis=None):
11311099
"""
11321100
Repeat elements of an array.
11331101
1134-
For full documentation refer to :obj:`numpy.ndarray.repeat`.
1135-
1136-
Parameters
1137-
----------
1138-
repeat : Union[int, Tuple[int, ...]]
1139-
The number of repetitions for each element.
1140-
`repeats` is broadcasted to fit the shape of the given axis.
1141-
axis : Optional[int]
1142-
The axis along which to repeat values. The `axis` is required
1143-
if input array has more than one dimension.
1144-
1145-
Returns
1146-
-------
1147-
out : dpnp_array
1148-
Array with repeated elements.
1149-
1150-
Examples
1151-
--------
1152-
>>> import dpnp as np
1153-
>>> x = np.array([3])
1154-
>>> x.repeat(4)
1155-
array([3, 3, 3, 3])
1102+
For full documentation refer to :obj:`dpnp.repeat`.
11561103
11571104
"""
11581105

dpnp/dpnp_iface_manipulation.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,10 @@ def ravel(a, order="C"):
979979
Parameters
980980
----------
981981
x : {dpnp_array, usm_ndarray}
982-
Input array. The elements in a are read in the order specified by order,
982+
Input array. The elements in `a` are read in the order specified by order,
983983
and packed as a 1-D array.
984984
order : {'C', 'F'}, optional
985-
The elements of a are read using this index order. ``C`` means to index
985+
The elements of `a` are read using this index order. ``C`` means to index
986986
the elements in row-major, C-style order, with the last axis index
987987
changing fastest, back to the first axis index changing slowest. ``F``
988988
means to index the elements in column-major, Fortran-style order, with
@@ -991,8 +991,8 @@ def ravel(a, order="C"):
991991
992992
Returns
993993
-------
994-
y : dpnp_array
995-
`y` is a contiguous 1-D array of the same subtype as a, with shape (a.size,)
994+
out : dpnp_array
995+
`out` is a contiguous 1-D array of the same subtype as `a`, with shape (a.size,)
996996
997997
See Also
998998
--------
@@ -1026,17 +1026,17 @@ def repeat(a, repeats, axis=None):
10261026
----------
10271027
x : {dpnp_array, usm_ndarray}
10281028
Input array.
1029-
repeat : Union[int, Tuple[int, ...]]
1030-
The number of repetitions for each element.
1031-
`repeats` is broadcasted to fit the shape of the given axis.
1032-
axis : Optional[int]
1033-
The axis along which to repeat values. The `axis` is required
1034-
if input array has more than one dimension.
1029+
repeat : int or array of int
1030+
The number of repetitions for each element. `repeats` is broadcasted to fit
1031+
the shape of the given axis.
1032+
axis : int, optional
1033+
The axis along which to repeat values. By default, use the flattened input array,
1034+
and return a flat output array.
10351035
10361036
Returns
10371037
-------
10381038
out : dpnp_array
1039-
Array with repeated elements.
1039+
Output array which has the same shape as `a`, except along the given axis.
10401040
10411041
See Also
10421042
--------
@@ -1049,6 +1049,17 @@ def repeat(a, repeats, axis=None):
10491049
>>> np.repeat(x, 4)
10501050
array([3, 3, 3, 3])
10511051
1052+
>>> x = np.array([[1,2], [3,4]])
1053+
>>> np.repeat(x, 2)
1054+
array([1, 1, 2, 2, 3, 3, 4, 4])
1055+
>>> np.repeat(x, 3, axis=1)
1056+
array([[1, 1, 1, 2, 2, 2],
1057+
[3, 3, 3, 4, 4, 4]])
1058+
>>> np.repeat(x, [1, 2], axis=0)
1059+
array([[1, 2],
1060+
[3, 4],
1061+
[3, 4]])
1062+
10521063
"""
10531064

10541065
rep = repeats

0 commit comments

Comments
 (0)