-
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
Support 0D for paddle.sort/argsort #49501
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -40,6 +42,11 @@ void ArgsortGradKernel(const Context& dev_ctx, | |||
|
|||
if (out_grad.numel() == 0) return; | |||
|
|||
if (rank == 0) { | |||
phi::funcs::set_constant(dev_ctx, in_grad, 1.0); |
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.
这个是不是得用上面那个函数 int r = xpu::constant( ...
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.
应该不用,我看有类似文件也是这么直接调用的,比如log_softmax和softmax。
out1.backward() | ||
out2.backward() | ||
|
||
self.assertEqual(out1.shape, []) |
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.
前反向kernel计算逻辑没问题,可以在单测里面再加一下前反向值的检查,因为值比较固定。XPU也一样
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.
done
77fe4d4
to
31c327f
Compare
31c327f
to
d486046
Compare
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
PR types
Function optimization
PR changes
OPs
Describe
Support 0D for paddle.sort/argsort