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.43/97/98/100 #263

Merged
merged 2 commits into from
Sep 4, 2023
Merged

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Aug 29, 2023

PR Docs

#112

97 torch.Tensor.resize_as_ 映射文档 PaddlePaddle/docs#6149
98 torch.Tensor.round_ 已有文档验证无误
100 torch.Tensor.scatter_add 已有文档验证无误
43 torch.nn.Threshold 已有文档验证无误

PR APIs

@paddle-bot
Copy link

paddle-bot bot commented Aug 29, 2023

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Aug 29, 2023
@co63oc co63oc added the HappyOpenSource 快乐开源活动issue与PR label Aug 29, 2023
@co63oc co63oc changed the title 转换规则 No.43/97/98/100/120 转换规则 No.43/97/98/100 Aug 29, 2023

API_TEMPLATE = textwrap.dedent(
"""
paddle.reshape({}, {}.shape)
Copy link
Collaborator

Choose a reason for hiding this comment

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

torch的是不是inplace的操作?更适合reshape_

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@@ -2027,7 +2036,12 @@
"out"
]
},
"torch.Tensor.round_": {},
"torch.Tensor.round_": {
"Matcher": "TensorRoundMatcher",
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是inplace操作的,还不能直接用非inplace的API,inplace操作是指会原位操作:

y = paddle.abs_(x)   # x自身被修改,返回x
y = paddle.abs(x)    # x不会被修改,返回一个新的Tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改使用paddle.assign

if "decimals" in kwargs:
API_TEMPLATE = textwrap.dedent(
"""
paddle.assign(paddle.round((10**{}) * {}) / (10**{}), {})
Copy link
Collaborator

Choose a reason for hiding this comment

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

能否使用映射文档中的这种写法:

infoflow 2023-08-29 15-02-26

Copy link
Contributor 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 83ad192 into PaddlePaddle:master Sep 4, 2023
@co63oc co63oc deleted the api100 branch September 7, 2023 06:52
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