Skip to content
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

Merged
merged 5 commits into from
Jan 5, 2023
Merged

Support 0D for paddle.sort/argsort #49501

merged 5 commits into from
Jan 5, 2023

Conversation

DesmonDay
Copy link
Contributor

PR types

Function optimization

PR changes

OPs

Describe

Support 0D for paddle.sort/argsort

@paddle-bot
Copy link

paddle-bot bot commented Jan 3, 2023

你的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.

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是得用上面那个函数 int r = xpu::constant( ...

Copy link
Contributor Author

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, [])
Copy link
Contributor

Choose a reason for hiding this comment

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

前反向kernel计算逻辑没问题,可以在单测里面再加一下前反向值的检查,因为值比较固定。XPU也一样

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@DesmonDay DesmonDay force-pushed the support-0D-sort branch 4 times, most recently from 77fe4d4 to 31c327f Compare January 5, 2023 07:12
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@DesmonDay DesmonDay merged commit 032da73 into develop Jan 5, 2023
@luotao1 luotao1 deleted the support-0D-sort branch January 11, 2023 02:22
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