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

[AMP OP&Test] add fp16/bf16 unittest for pool2d op #52288

Merged
merged 11 commits into from
Apr 12, 2023

Conversation

weisy11
Copy link
Contributor

@weisy11 weisy11 commented Mar 29, 2023

PR types

Others

PR changes

OPs

Describe

add bf16 support and bf16/fp16 unittest for pool2d

@paddle-bot
Copy link

paddle-bot bot commented Mar 29, 2023

你的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.

@paddle-bot
Copy link

paddle-bot bot commented Mar 29, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@weisy11 weisy11 changed the title add bf16 support and bf16/fp16 unittest for pool2d [AMP OP&Test] add fp16/bf16 unittest for pool2d op Mar 30, 2023
@@ -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"
Copy link
Contributor

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)
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

check_grad是否必需?之前设置为true可能是因为单测框架有问题,现在可以试着去掉测下

Copy link
Contributor

@ZzSean ZzSean left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@phlrain phlrain left a 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

@ZzSean ZzSean merged commit f9b155f into PaddlePaddle:develop Apr 12, 2023
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.

3 participants