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

转换规则 No.307/372 #246

Merged
merged 1 commit into from
Aug 28, 2023
Merged

转换规则 No.307/372 #246

merged 1 commit into from
Aug 28, 2023

Conversation

co63oc
Copy link
Collaborator

@co63oc co63oc commented Aug 23, 2023

PR Docs

#112

映射文档 PaddlePaddle/docs#6120

参数中有dtype,GenericMatcher转换为astype有错误,增加 AutocastMatcher 转换

307 torch.autocast
372 torch.cpu.amp.autocast

PR APIs

@luotao1 luotao1 added contributor External developers HappyOpenSource 快乐开源活动issue与PR labels Aug 23, 2023
@@ -139,6 +139,33 @@ def get_paddle_class_nodes(self, func, args, kwargs):
return "delete"


class AutocastMatcher(BaseMatcher):
def generate_code(self, kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个不可以用GenericMatcher吗

Copy link
Collaborator Author

@co63oc co63oc Aug 23, 2023

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方式

@co63oc co63oc force-pushed the api372 branch 2 times, most recently from b8a6863 to 3d2b0ef Compare August 23, 2023 23:36
"dtype",
"cache_enabled"
],
"kwargs_change": {
Copy link
Collaborator

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处理方式

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 merged commit eec9ad8 into PaddlePaddle:master Aug 28, 2023
8 checks passed
@co63oc co63oc deleted the api372 branch August 30, 2023 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants