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 bf16 fp16 test case for interpolate #51160
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -329,6 +331,356 @@ def init_test_case(self): | |||
self.align_corners = False | |||
|
|||
|
|||
class TestBicubicInterpOpFP16(OpTest): |
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.
将TestBicubicInterpOp 中的dtype单独拿出来设置,FP16可以直接继承TestBicubicInterpOp,避免过多重复代码
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.
done
self.outputs = {'Out': output_np} | ||
|
||
def test_check_output(self): | ||
if platform.system() == "Linux": |
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.
done
'Out', | ||
in_place=True, | ||
check_eager=True, | ||
max_relative_error=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.
同上
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.
done
|
||
|
||
class TestBicubicInterpOpFP16(TestBicubicInterpOp): | ||
def test_check_output(self): |
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.
fp16默认为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.
done
self.outputs = {'Out': convert_float_to_uint16(output_np)} | ||
|
||
def test_check_output(self): | ||
self.check_output(check_dygraph=self.check_dygraph, 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 的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.
done
'Out', | ||
in_place=True, | ||
check_dygraph=self.check_dygraph, | ||
max_relative_error=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.
同上
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.
done
['X'], | ||
'Out', | ||
in_place=True, | ||
max_relative_error=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.
可以尝试默认值是否可以通过
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.
done
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
PR types
Others
PR changes
OPs
Describe
add bf16 fp16 test case for interpolate