Skip to content

Commit 3c241a2

Browse files
authored
Add copy kwarg support to reshape (#386)
1 parent a890906 commit 3c241a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

spec/API_specification/signatures/manipulation_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def permute_dims(x: array, /, axes: Tuple[int, ...]) -> array:
7171
an array containing the axes permutation. The returned array must have the same data type as ``x``.
7272
"""
7373

74-
def reshape(x: array, /, shape: Tuple[int, ...]) -> array:
74+
def reshape(x: array, /, shape: Tuple[int, ...], *, copy: Optional[bool] = None) -> array:
7575
"""
7676
Reshapes an array without changing its data.
7777
@@ -81,11 +81,13 @@ def reshape(x: array, /, shape: Tuple[int, ...]) -> array:
8181
input array to reshape.
8282
shape: Tuple[int, ...]
8383
a new shape compatible with the original shape. One shape dimension is allowed to be ``-1``. When a shape dimension is ``-1``, the corresponding output array shape dimension must be inferred from the length of the array and the remaining dimensions.
84+
copy: Optional[bool]
85+
boolean indicating whether or not to copy the input array. If ``True``, the function must always copy. If ``False``, the function must never copy and must raise a ``ValueError`` in case a copy would be necessary. If ``None``, the function must reuse existing memory buffer if possible and copy otherwise. Default: ``None``.
8486
8587
Returns
8688
-------
8789
out: array
88-
an output array having the same data type, elements, and underlying element order as ``x``.
90+
an output array having the same data type and elements as ``x``.
8991
"""
9092

9193
def roll(x: array, /, shift: Union[int, Tuple[int, ...]], *, axis: Optional[Union[int, Tuple[int, ...]]] = None) -> array:

0 commit comments

Comments
 (0)