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

【Hackathon 5th No.26】为 Paddle 新增 diagonal_scatter API -part #57879

Merged
merged 16 commits into from Nov 17, 2023

Conversation

DanGuge
Copy link
Contributor

@DanGuge DanGuge commented Oct 5, 2023

PR types

Others

PR changes

Others

Description

为 Paddle 新增 diagonal_scatter API
RFC:PaddlePaddle/community#669
#57262

@paddle-bot
Copy link

paddle-bot bot commented Oct 5, 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.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Oct 13, 2023

Sorry to inform you that bab7de6's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@DanGuge
Copy link
Contributor Author

DanGuge commented Nov 5, 2023

@zxcd 辛苦review一下,diagonal_scatter的实现

python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
test/legacy_test/test_diagonal_scatter.py Outdated Show resolved Hide resolved
@DanGuge DanGuge requested a review from zxcd November 8, 2023 02:07
@DanGuge
Copy link
Contributor Author

DanGuge commented Nov 8, 2023

@zxcd 修改完了,辛苦再review一下

Copy link
Contributor

@zxcd zxcd left a comment

Choose a reason for hiding this comment

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

LGTM

@jeff41404
Copy link
Contributor

jeff41404 commented Nov 9, 2023

The logic of the diagonal_scatter API and the existing function fill_diagonal_tensor in python/paddle/tensor/manipulation.py are most of the same, whether it can be directly exposed as an alias of fill_diagonal_tensor function, so no need to add additional Python logic? Meanwhile, its underlying operator fill_ Diagonal_ tensor needs to add support for int16 data types

@DanGuge
Copy link
Contributor Author

DanGuge commented Nov 9, 2023

The logic of the diagonal_scatter API and the existing function fill_diagonal_tensor in python/paddle/tensor/manipulation.py are most of the same, whether it can be directly exposed as an alias of fill_diagonal_tensor function, so no need to add additional Python logic? Meanwhile, its underlying operator fill_ Diagonal_ tensor needs to add support for int16 data types

@jeff41404

  1. There is still difference between fill_diagonal_tensor and diagonal_scatter, the former one is only available in dynamic mode while the latter one supports both dynamic & static mode. And I think maybe we should not change the origin usage of fill_diagonal_tensor, so it may be better to add additional API for diagonal_scatter.
  2. I can submit another PR for int16 data types of fill_diagonal_tensor & add relative changes, e.g. tests and so on.

@jeff41404
Copy link
Contributor

jeff41404 commented Nov 13, 2023

  1. There is still difference between fill_diagonal_tensor and diagonal_scatter, the former one is only available in dynamic mode while the latter one supports both dynamic & static mode. And I think maybe we should not change the origin usage of fill_diagonal_tensor, so it may be better to add additional API for diagonal_scatter.

Adding branch of static mode to the current API fill_diagonal_tensor is the compatibility upgrade and correct approach, which can reduce future maintenance costs, as long as it is clearly described in the rfc document and pass existing test case.

@jeff41404
Copy link
Contributor

2. I can submit another PR for int16 data types of fill_diagonal_tensor & add relative changes, e.g. tests and so on.

OK, you can add link of PR to the description above and add these tasks to rfc

@DanGuge
Copy link
Contributor Author

DanGuge commented Nov 14, 2023

@jeff41404 cc @zxcd
I added the logic of static mode to fill_diagonal_tensor and simplified diagonal_scatter.
And I added int16 to fill_diagonal_tensor in this PR, please review it.

jeff41404
jeff41404 previously approved these changes Nov 15, 2023
Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ooooo-create ooooo-create left a comment

Choose a reason for hiding this comment

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

其余LGTM @sunzhongkai588

python/paddle/tensor/manipulation.py Show resolved Hide resolved
python/paddle/tensor/manipulation.py Outdated Show resolved Hide resolved
DanGuge and others added 2 commits November 16, 2023 20:07
Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>
Copy link
Contributor

@ooooo-create ooooo-create left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM for docs

@luotao1 luotao1 changed the title 【Hackathon 5th No.26】为 Paddle 新增 diagonal_scatter API 【Hackathon 5th No.26】为 Paddle 新增 diagonal_scatter API -part Nov 17, 2023
@luotao1 luotao1 merged commit 98bb0b8 into PaddlePaddle:develop Nov 17, 2023
28 checks passed
@luotao1
Copy link
Contributor

luotao1 commented Nov 17, 2023

hi, @DanGuge

  • 非常感谢你对飞桨框架的贡献,我们正在运营一个PFCC组织,会通过定期分享技术知识与发布开发者主导任务的形式持续为飞桨框架做贡献,详情可见 https://github.com/luotao1 主页说明。
  • 如果你对PFCC有兴趣,请发送邮件至 ext_paddle_oss@baidu.com,我们会邀请你加入~

SecretXV pushed a commit to SecretXV/Paddle that referenced this pull request Nov 28, 2023
…ddle#57879)

* add diagonal_scatter

* add diagonal_scatter_test

* add annotations

* modify int32/int64 test range

* update diagonal_scatter doc

* fix: bfloat16 type & test name & LayerHelper position

* add diagonal scatter in __all__ list

* add int16 in fill_diagonal_tensor & reuse the logic of fill_diagonal_tensor for diagonal_scatter

* remove xpu settings

* op test get_numeric_gradient does not support int16

* fix

* Update python/paddle/tensor/manipulation.py

Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>

* Update python/paddle/tensor/manipulation.py

Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>

* fix review suggestions

* Update python/paddle/tensor/manipulation.py

Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>

* fix

---------

Co-authored-by: ooo oo <106524776+ooooo-create@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants