Skip to content
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

[cherry-pick] Fix numpy2.1 bug in py3.10 #67866

Merged
merged 5 commits into from
Sep 2, 2024

Conversation

risemeup1
Copy link
Contributor

@risemeup1 risemeup1 commented Aug 30, 2024

PR Category

Execute Infrastructure

PR Types

Others

Description

Fix the bug in PaddlePaddle under Python 3.10 and NumPy 2.1.

image
  • For any __array__ method on a non-NumPy array-like object, dtype=None and copy=None keywords must be added to the signature - this will work with older NumPy versions as well (although older numpy versions will never pass in copy keyword). If the keywords are added to the __array__ signature, then for:

    copy=True and any dtype value always return a new copy,

    copy=None create a copy if required (for example by dtype),

    copy=False a copy must never be made. If a copy is needed to return a numpy array or satisfy dtype, then raise an exception (ValueError).

  • Restricting numpy to version 1.21 or above is to fix the bug of not finding the ‘NDArray’ attribute when using the numpy.typing module. It's no need to cherry-pick to 2.6

To do:
Modify the logic in TensorToPyArray(self) according to the dtype and copy parameters.
pcard-67164

Copy link

paddle-bot bot commented Aug 30, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@risemeup1 risemeup1 changed the base branch from develop to release/2.6 August 30, 2024 07:15
@SigureMo SigureMo changed the title [cherry-pick]Fix numpu2.1 bug in py3.10 [cherry-pick] Fix numpy2.1 bug in py3.10 Aug 31, 2024
@risemeup1 risemeup1 force-pushed the fix_numpu2.1_bug_in_py3.10 branch from 4bfdea1 to 2726fd6 Compare September 2, 2024 08:43
@phlrain phlrain merged commit 64c6937 into release/2.6 Sep 2, 2024
13 of 16 checks passed
@SigureMo SigureMo deleted the fix_numpu2.1_bug_in_py3.10 branch September 2, 2024 11:00
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.

2 participants