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.384-387 #245

Merged
merged 1 commit into from
Aug 25, 2023
Merged

转换规则 No.384-387 #245

merged 1 commit into from
Aug 25, 2023

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Aug 23, 2023

PR Docs

#112
映射文档 PaddlePaddle/docs#6119

384 torch.nn.Module.register_parameter 因为调用 torch.nn.parameter.Parameter 不能转换,测试用例设置为unsupport
385 torch.nn.Module.get_submodule 替换为属性
386 torch.nn.Module.get_parameter 替换为属性, 因为调用 torch.nn.parameter.Parameter 不能转换,测试用例设置为unsupport
387 torch.nn.Module.get_buffer 替换为属性

PR APIs

@luotao1 luotao1 added contributor External developers HappyOpenSource 快乐开源活动issue与PR labels Aug 23, 2023
@@ -3942,6 +3942,15 @@ def generate_code(self, kwargs):
return code


class ModuleGetSubMatcher(BaseMatcher):
def generate_code(self, kwargs):
code = "{}.{}".format(
Copy link
Collaborator

Choose a reason for hiding this comment

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

getattr({}, {}) 来实现吧,因为target可能是一个字符串变量,可能会出错

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

x = torch.tensor([1., 2., 3.])
module1 = torch.nn.Module()
module1.register_parameter('param1', torch.nn.parameter.Parameter(x))
result = module2.get_parameter('param1')
Copy link
Collaborator

Choose a reason for hiding this comment

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

torch.nn.Linear(10, 10).weight 这种形式返回一个Parameter吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

查看已有torch.nn.parameter.Parameter,已修改

import torch
x = torch.tensor([1., 2., 3.])
module1 = torch.nn.Module()
module1.register_parameter('param1', torch.nn.parameter.Parameter(x))
Copy link
Collaborator

Choose a reason for hiding this comment

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

torch.nn.Linear(10, 10).weight 这种形式返回一个Parameter吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

查看已有torch.nn.parameter.Parameter,已修改

"args_list": [
"target"
]
},
"torch.nn.Module.get_extra_state": {},
"torch.nn.Module.get_parameter": {},
Copy link
Collaborator

Choose a reason for hiding this comment

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

get_parameter、register_parameter还没有实现

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@zhwesky2010 zhwesky2010 changed the title 映射文档 No.384-387 转换规则 No.384-387 Aug 25, 2023
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 a683829 into PaddlePaddle:master Aug 25, 2023
@co63oc co63oc deleted the api387 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.

3 participants