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

API improvement for paddle.argsort and paddle.sort 易用性提升 #63513

Merged
merged 9 commits into from
Apr 23, 2024

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Apr 14, 2024

PR Category

User Experience

PR Types

Improvements

Description

为 paddle.argsort 和 paddle.sort 支持 stable 参数,stable = True 时使用稳定排序算法,stable = False 时不保证排序算法稳定。

Copy link

paddle-bot bot commented Apr 14, 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.

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 14, 2024

针对 sort API: torch返回value和indices,paddle仅返回value 的问题,是否需要新增 return_indices 参数,默认为 False,为 True 时返回 value和indices

@paddle-bot paddle-bot bot added the contributor External developers label Apr 14, 2024
@NKNaN NKNaN changed the title API improvement for paddle.argsort and paddle.sort API improvement for paddle.argsort and paddle.sort 易用性提升 Apr 15, 2024
def init(self):
self.input_shape = [40, 3, 4]
self.axis = 0
self.data = np.array(
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是self.input_data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,已修改

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Apr 17, 2024

@NKNaN 看一下上面这个self.input_data,单测是不是没有测试到,其他地方没问题了

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 17, 2024

@NKNaN 看一下上面这个self.input_data,单测是不是没有测试到,其他地方没问题了

好的

zhwesky2010
zhwesky2010 previously approved these changes Apr 17, 2024
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

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Apr 17, 2024

@NKNaN custom cpu的kernel修改已经合入了,可以rerun下Py-3,如果还有问题的话,可以本地git clone CustomDevice联调下,看除了custom_kernel:ArgSortKernel的stable参数是否还有其他问题

@zhwesky2010
Copy link
Contributor

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 17, 2024

@NKNaN op_version.yaml也需要修改一下,参考这个,需要描述对op行为的改变

已增加描述。
op_version.yaml 之后在修改 kernel 的时候都需要改吗?

@zhwesky2010 zhwesky2010 self-assigned this Apr 18, 2024
@zhwesky2010
Copy link
Contributor

@NKNaN op_version.yaml也需要修改一下,参考这个,需要描述对op行为的改变

已增加描述。 op_version.yaml 之后在修改 kernel 的时候都需要改吗?

增加/删除input、增加/删除output、增加/删除attr,这几种情况是需要的

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 18, 2024

增加/删除input、增加/删除output、增加/删除attr,这几种情况是需要的

好的

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

Comment on lines +36 to +38
* @param stable Indicate whether to use stable sorting algorithm, which
* guarantees that the order of equivalent elements is
* preserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

注释缩进有点问题

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revised here:
#63796

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Apr 23, 2024

针对 sort API: torch返回value和indices,paddle仅返回value 的问题,是否需要新增 return_indices 参数,默认为 False,为 True 时返回 value和indices

这个当前因为有argsort提供了indices功能,所以先不用修改。

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010
Copy link
Contributor

@NKNaN 记得更新一下 API中文文档API映射文档

@luotao1 luotao1 merged commit e60afe0 into PaddlePaddle:develop Apr 23, 2024
29 of 30 checks passed
@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 23, 2024

这个当前因为有argsort提供了indices功能,所以先不用修改。

好的

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 23, 2024

@NKNaN 记得更新一下 API中文文档API映射文档

好的

co63oc pushed a commit to co63oc/Paddle that referenced this pull request Apr 24, 2024
…e#63513)

* add stable to argsort and sort

* update

* update xpu kernel and test

* update xpu test

* add argsort docs code example

* fix test

* update op_version.yaml

* fix conflict

* delete additional test
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Apr 25, 2024
…e#63513)

* add stable to argsort and sort

* update

* update xpu kernel and test

* update xpu test

* add argsort docs code example

* fix test

* update op_version.yaml

* fix conflict

* delete additional test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants