Skip to content

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

Merged
HydrogenSulfate merged 1 commit intoPaddlePaddle:developfrom
HydrogenSulfate:fix_to_inplace
Oct 28, 2024
Merged

[API] Change Tensor.to from in-place to a out-of-place operation#68992
HydrogenSulfate merged 1 commit intoPaddlePaddle:developfrom
HydrogenSulfate:fix_to_inplace

Conversation

@HydrogenSulfate
Copy link
Copy Markdown
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
@paddle-bot
Copy link
Copy Markdown

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
Copy Markdown
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
@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