Skip to content

Add copy kwarg support to reshape #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions spec/API_specification/signatures/manipulation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def permute_dims(x: array, /, axes: Tuple[int, ...]) -> array:
an array containing the axes permutation. The returned array must have the same data type as ``x``.
"""

def reshape(x: array, /, shape: Tuple[int, ...]) -> array:
def reshape(x: array, /, shape: Tuple[int, ...], *, copy: Optional[bool] = None) -> array:
"""
Reshapes an array without changing its data.

Expand All @@ -81,11 +81,13 @@ def reshape(x: array, /, shape: Tuple[int, ...]) -> array:
input array to reshape.
shape: Tuple[int, ...]
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.
copy: Optional[bool]
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``.

Returns
-------
out: array
an output array having the same data type, elements, and underlying element order as ``x``.
an output array having the same data type and elements as ``x``.
"""

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