Skip to content
New issue

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

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

Already on GitHub? # to your account

升级飞桨代码中使用Numpy 1.20 数据类型的用法 #49949

Closed
dingjiaweiww opened this issue Jan 19, 2023 · 0 comments
Closed

升级飞桨代码中使用Numpy 1.20 数据类型的用法 #49949

dingjiaweiww opened this issue Jan 19, 2023 · 0 comments
Assignees

Comments

@dingjiaweiww
Copy link
Contributor

dingjiaweiww commented Jan 19, 2023

任务描述:

Numpy 从1.20 版本开始不推荐使用内置类型的别名,如np.int、np.bool、np.float、np.complex 等,更多背景信息请参考Numpy 1.20.0 release note,继续使用这些别名会产生一些不必要的warning(如 issue:41745),飞桨计划取消对numpy这些废弃用法的使用,目前我们已经在框架代码中删除了这些废弃的用法(详见pr:42929),但是飞桨框架单测代码以及其他飞桨套件中仍有不少地方仍然使用,如果你对这部分有兴趣,可以尝试升级飞桨代码中对于numpy 的用法。

飞桨代码修复指南(整体进度 4/4)

废弃用法 替换为 认领人 PR
np.bool np.bool_ @DrRyanHuang #49961 ✅ (2023/1/30)
np.int np.int64 @Liyulingyue #49967 ✅ (2023/1/31)
np.float np.float64 @longranger2 #49970✅ (2023/1/31)
np.complex np.complex128
np.object np.object_
np.str np.str_
np.unicode np.str_ @kk-2000 #49975 ✅ (2023/1/31)

可参考pr:#42929

修复范围

飞桨训练推理框架:https://github.com/PaddlePaddle/Paddle

下表显示了不推荐使用的别名的完整列表及其确切含义:

废弃语法名称 等价于 含义
numpy.bool bool numpy.bool_
numpy.int int numpy.int_ (default), numpy.int64, or numpy.int32
numpy.float float numpy.float64, numpy.float_, numpy.double (equivalent)
numpy.complex complex numpy.complex128, numpy.complex_, numpy.cdouble (equivalent)
numpy.object object numpy.object_
numpy.str str numpy.str_
numpy.long int numpy.int_ (C long), numpy.longlong (largest integer type)
numpy.unicode str numpy.unicode_
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Development

No branches or pull requests

4 participants