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] improve FP16 and BF16 OpTest for maximum, minimum and multiply op #52256

Merged
merged 6 commits into from
Mar 31, 2023

Conversation

FlyingQianMM
Copy link
Contributor

@FlyingQianMM FlyingQianMM commented Mar 28, 2023

PR types

Others

PR changes

Others

Describe

@paddle-bot
Copy link

paddle-bot bot commented Mar 28, 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.

@FlyingQianMM FlyingQianMM force-pushed the develop_amp branch 4 times, most recently from 8ccd912 to be08bd8 Compare March 29, 2023 06:48
@@ -178,31 +246,13 @@ def setUp(self):

def test_check_output(self):
if hasattr(self, 'attrs'):
self.check_output(check_dygraph=False)
self.check_output(check_dygraph=False, atol=1e-2)
Copy link
Contributor

@ZzSean ZzSean Mar 30, 2023

Choose a reason for hiding this comment

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

这里无需设置,默认值即为1e-2,下同

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改,感谢


def test_check_grad_normal(self):
if hasattr(self, 'attrs'):
# check_prim=False, bfloat16 is not supported in `less_equal`
self.check_grad(['X', 'Y'], 'Out', check_dygraph=False)
Copy link
Contributor

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.

这部分代码是多余的,因为已修改为继承TestElementwiseFP16Op

@@ -61,6 +60,36 @@ def test_check_grad_ingore_y(self):
)


class TestElementwiseFP16Op(TestElementwiseOp):
def setUp(self):
self.op_type = "elementwise_min"
Copy link
Contributor

Choose a reason for hiding this comment

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

需设置self.dtype

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已设置,感谢~

self.outputs = {'Out': np.minimum(self.inputs['X'], self.inputs['Y'])}

def test_check_output(self):
self.check_output(atol=1e-3)
Copy link
Contributor

@ZzSean ZzSean Mar 30, 2023

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.

已删除,感谢~

@@ -150,16 +150,30 @@ def setUp(self):
self.if_enable_cinn()

def test_check_output(self):
self.check_output()
self.check_output(atol=1e-2)
Copy link
Contributor

@ZzSean ZzSean Mar 30, 2023

Choose a reason for hiding this comment

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

这里bf16默认即为1e-2,无需设置,下同

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除,感谢~

@FlyingQianMM FlyingQianMM changed the title [AMP_OP&Test] add FP16 and BF16 OpTest for minimum and multiply op [AMP_OP&Test] add FP16 and BF16 OpTest for maximum, minimum and multiply op Mar 30, 2023
@FlyingQianMM FlyingQianMM changed the title [AMP_OP&Test] add FP16 and BF16 OpTest for maximum, minimum and multiply op [AMP_OP&Test] improve FP16 and BF16 OpTest for maximum, minimum and multiply op Mar 30, 2023
ZzSean
ZzSean previously approved these changes Mar 30, 2023
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
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

@FlyingQianMM FlyingQianMM merged commit 4c6ad5c into PaddlePaddle:develop Mar 31, 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.

4 participants