-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
【Inplace api】Add copy for inplace #54683
【Inplace api】Add copy for inplace #54683
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
bool trace_backward = egr::Controller::Instance().HasGrad(); | ||
bool require_any_grad = egr::EagerUtils::ComputeRequireGrad({}); | ||
|
||
// Node Declaration |
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.
生成代码的缩进也需要对齐
// Node Declaration | ||
std::shared_ptr<{}> grad_node; | ||
|
||
//Set grad_node before API Call |
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.
注释后需要一个空格
// Check Inplace if needed | ||
{}{} | ||
// Node Creation | ||
//Set grad_node after API call |
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.
同上
'y must be scalar or tensor type, but received: %s ' % (type([2])), | ||
): | ||
paddle.pow_(var, [2]) | ||
|
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.
shall we check gradients of inplace paddle.pow_
?
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.
TestInplacePowerScalar(Tensor) inherit from TestDygraphInplace, which contains the backward test
in description, before code of |
It has been changed to auto api_result = paddle::experimental::pow(x, y); |
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
def pow_(x, y, name=None): | ||
""" | ||
Inplace version of ``pow`` API, the output Tensor will be inplaced with input ``x``. | ||
Please refer to :ref:`api_tensor_pow`. |
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.
好像这个标签不正确,导致没有正确引用。试试改成api_paddle_pow
,或者在api_label 中加入该标签
PR types
Others
PR changes
Others
Description
Pcard-72375
add Input copy for inpalce api backward calculate
Normal api change
Before:
After this pr merge:
Inplace api change
will add Input copy in inplace pow as follow