-
Notifications
You must be signed in to change notification settings - Fork 5.8k
修改tensor.data的返回,返回的张量不包含梯度信息 #73246
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
Conversation
modified: paddle/fluid/pybind/eager_properties.cc
你的PR提交成功,感谢你对开源项目的贡献! |
return reinterpret_cast<PyObject*>(self); | ||
paddle::Tensor new_tensor(self->tensor.impl()); | ||
|
||
auto meta = std::make_shared<egr::AutogradMeta>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tensor.data剥离了反向,应该不需要AutogradMeta了吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯,收到,已修改。测试了一下,不需要重新设置stopgradient,新的tensor没有梯度信息。
modified: paddle/fluid/pybind/eager_properties.cc
CI / Mac-CPU / Build and test (pull_request)这个检查没有找到在哪里可以重新启动 |
非required的失败不影响合入 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* modified tensor.data modified: paddle/fluid/pybind/eager_properties.cc * deleted meta modified: paddle/fluid/pybind/eager_properties.cc
PR Category
User Experience
PR Types
Improvements
Description
tensor.data功能和pytorch对齐,返回不包含梯度信息的tensor
测试代码: