-
Notifications
You must be signed in to change notification settings - Fork 53
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
转换规则 No.307/372 #246
转换规则 No.307/372 #246
Conversation
paconvert/api_matcher.py
Outdated
@@ -139,6 +139,33 @@ def get_paddle_class_nodes(self, func, args, kwargs): | |||
return "delete" | |||
|
|||
|
|||
class AutocastMatcher(BaseMatcher): | |||
def generate_code(self, kwargs): |
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.
这个不可以用GenericMatcher吗
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.
GenericMatcher 中 dtype参数修改为astype,autocast不支持,已有torch.cuda.amp.autocast测试用例是用def _test方式
b8a6863
to
3d2b0ef
Compare
"dtype", | ||
"cache_enabled" | ||
], | ||
"kwargs_change": { |
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.
dtype的问题可以在kwargs_change中配置来实现:
"dtype": "dtype"
这样就会直接将torch的dtype赋值给paddle的dtype,而不会采用默认的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.
已修改
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 Docs
#112
映射文档 PaddlePaddle/docs#6120
参数中有dtype,GenericMatcher转换为astype有错误,增加 AutocastMatcher 转换
307 torch.autocast
372 torch.cpu.amp.autocast
PR APIs