-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix numpy2.1 bug when python >=3.10 #67700
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
a8e4835
to
82a4f42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will fix #67602 .
but probably more work are needed for : https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword
82a4f42
to
e5a7ebe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix * fix * fix * fix * fix codestyle --------- Co-authored-by: SigureMo <sigure.qaq@gmail.com>
PR Category
Execute Infrastructure
PR Types
Others
Description
Fix the bug in PaddlePaddle under Python 3.10 and NumPy 2.1.
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.To do:
Modify the logic in TensorToPyArray(self) according to the dtype and copy parameters.
pcard-67164