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

data type extension of operators #5039

Merged
merged 4 commits into from
Jul 20, 2022

Conversation

zhangting2020
Copy link
Contributor

@zhangting2020 zhangting2020 commented Jul 6, 2022

data type extension of operators

@@ -0,0 +1,108 @@
# 算子数据类型扩展 验收规范

## CI通过性
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标题是多了字,还是少了字?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为 通过CI验证


提交至 Paddle repo 的 Pull Request(简称 PR),涉及到的相关检测CI必须全部 Pass。用来验证对之前功能点的兼容和影响,保障新合入代码对历史代码不产生影响。

新增代码必须要有相应的单测保障测试覆盖率达到准入要求(测试覆盖率(行覆盖率)90%)。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两重括号有点奇怪

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为 (行覆盖率达到90%)

扩展数据类型后需要添加对应数据类型的单元测试,并通过算子的精度检查。单元测试需要注意以下规范:
- [OP单测必须使用大尺寸输入](https://github.com/PaddlePaddle/Paddle/wiki/OP-test-input-shape-requirements)
- [反向Op必须调用check_grad](https://github.com/PaddlePaddle/Paddle/wiki/Gradient-Check-Is-Required-for-Op-Test)
- [单测精度中atol, rtol, eps, max_relative_error, 不允许自行放大阈值](https://github.com/PaddlePaddle/Paddle/wiki/OP-test-accuracy-requirements)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fp16可以给出建议的atol、rtol设置,因为默认的atol、rtol是针对fp64的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单测框架中check_out只提供了绝对误差atol的设置,默认是1e-5,允许用户修改这个值不是合理,例如下面的例子,实际第一个元素误差已经很大,allclose的绝对误差默认设置是1e-8,都能通过检查。

a = np.array([1.234678e-7, 5.8902198e-10])
b = np.array([1.244678e-7, 5.8902198e-10])
np.allclose(a,b) # True

check_grad的接口提供了max_relative_error设置,默认是0.005,这个相对误差容忍度感觉已经偏高了。

在单测规范中也说明了如有特殊需求,需要特定人员审核。应该由开发者给出验证结论后,再评估是否允许设置。

Copy link
Collaborator

@Xreki Xreki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhangting2020 zhangting2020 merged commit 15496d0 into PaddlePaddle:develop Jul 20, 2022
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