-
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] improve FP16 and BF16 OpTest for maximum, minimum and multiply op #52256
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
8ccd912
to
be08bd8
Compare
be08bd8
to
bd3d48d
Compare
@@ -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) |
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.
这里无需设置,默认值即为1e-2,下同
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.
已修改,感谢
|
||
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) |
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.
这里不用删吧
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.
这部分代码是多余的,因为已修改为继承TestElementwiseFP16Op
@@ -61,6 +60,36 @@ def test_check_grad_ingore_y(self): | |||
) | |||
|
|||
|
|||
class TestElementwiseFP16Op(TestElementwiseOp): | |||
def setUp(self): | |||
self.op_type = "elementwise_min" |
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.
需设置self.dtype
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.
已设置,感谢~
self.outputs = {'Out': np.minimum(self.inputs['X'], self.inputs['Y'])} | ||
|
||
def test_check_output(self): | ||
self.check_output(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.
无需设置,下同
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.
已删除,感谢~
@@ -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) |
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.
这里bf16默认即为1e-2,无需设置,下同
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.
已删除,感谢~
58255af
to
4b78cda
Compare
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
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
Others
Describe