Skip to content

[API] Change Tensor.to from in-place to a out-of-place operation #68992

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

Merged

Conversation

HydrogenSulfate
Copy link
Contributor

@HydrogenSulfate HydrogenSulfate commented Oct 28, 2024

PR Category

User Experience

PR Types

Bug fixes

Description

Pcard-75624

修复前:

  • Tensor.to会对Tensor进行原地修改,行为不符合预期。

修复后:

  • Tensor.to只有当参数和Tensor完全一致时,直接返回自身,任一参数不一致则创建新的Tensor并返回,与pytorch的Tensor.to以及PIR下的Tensor.to行为保持一致

…mplicit in-place modifications that may lead to unexpected results or errors
Copy link

paddle-bot bot commented Oct 28, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@HydrogenSulfate HydrogenSulfate merged commit 60881cc into PaddlePaddle:develop Oct 28, 2024
27 checks passed
@HydrogenSulfate HydrogenSulfate deleted the fix_to_inplace branch October 28, 2024 07:40
fxfxfxfxfxfxfxfx pushed a commit to fxfxfxfxfxfxfxfx/Paddle that referenced this pull request Oct 29, 2024
…mplicit in-place modifications that may lead to unexpected results or errors (PaddlePaddle#68992)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants