Skip to content

fix: use reshape instead of raw shape assignment for numpy arrays#539

Open
Trenza1ore wants to merge 1 commit into
google-deepmind:mainfrom
Trenza1ore:main
Open

fix: use reshape instead of raw shape assignment for numpy arrays#539
Trenza1ore wants to merge 1 commit into
google-deepmind:mainfrom
Trenza1ore:main

Conversation

@Trenza1ore

@Trenza1ore Trenza1ore commented Jul 10, 2026

Copy link
Copy Markdown

NumPy 2.5.0 deprecated assignment to shape attribute: numpy/numpy#29536

np.reshape(...) and np.ndarray.reshape(...) did not support copy=False until numpy>=2.1, therefore for compatibility's sake, I decided to just use np.reshape(shape).

This should be equivalent to the default copy=None in numpy>=2.1:

If None, a copy will only be made if it’s required by order.

Closes #540

NumPy 2.5.0 deprecated assignment to shape attribute
@google-cla

google-cla Bot commented Jul 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeprecationWarning: Setting the shape on a NumPy array has been deprecated in NumPy 2.5.

1 participant