-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[AMP OP&Test] add fp16/bf16 unittest for pool2d op #52288
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
@@ -14,7 +14,10 @@ | |||
|
|||
#include "paddle/phi/kernels/pool_grad_kernel.h" | |||
|
|||
#include "paddle/phi/common/bfloat16.h" | |||
#include "paddle/phi/common/data_type.h" |
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.
删除多余头文件
) | ||
|
||
if self.is_bfloat16_op(): | ||
output = output.astype(np.float32) |
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.
output也需要调用convert_float_to_uint16
place = core.CUDAPlace(0) | ||
self.check_output_with_place( | ||
place, | ||
atol=1e-3, |
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.
直接使用默认atol即可,无需设置
place, | ||
{'X'}, | ||
'Out', | ||
max_relative_error=0.07, |
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.
max_relative_error
需要先尝试默认值,其他的fp16单测也需要先尝试默认值
@@ -847,6 +912,20 @@ def init_shape(self): | |||
create_test_cudnn_fp16_class(TestCase4_channel_last) | |||
create_test_cudnn_fp16_class(TestCase5_channel_last) | |||
|
|||
create_test_fp16_class(TestPool2D_channel_last) | |||
create_test_fp16_class(TestCase1_channel_last, check_grad=False) |
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.
check_grad
是否必需?之前设置为true可能是因为单测框架有问题,现在可以试着去掉测下
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 for check_dygraph
PR types
Others
PR changes
OPs
Describe
add bf16 support and bf16/fp16 unittest for pool2d