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.linalg.svd_lowrank #62876

Merged
merged 5 commits into from
Apr 7, 2024

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Mar 20, 2024

PR Category

User Experience

PR Types

Improvements

Description

将 paddle 的 linalg.py 中已有的 svd_lowrank 函数计算逻辑公开出来,对照 pytorch: https://pytorch.org/docs/stable/generated/torch.svd_lowrank.html

Copy link

paddle-bot bot commented Mar 20, 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.

@paddle-bot paddle-bot bot added the contributor External developers label Mar 20, 2024
C = self.random_matrix(rank, columns, *batch_dims, **kwargs)
return B.matmul(C)

def run_subtest(
Copy link
Contributor

@zhwesky2010 zhwesky2010 Apr 1, 2024

Choose a reason for hiding this comment

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

numpy有计算svd_lowrank的API吗,如果有的话,单测对比结果时 可以简洁一些

Copy link
Contributor Author

Choose a reason for hiding this comment

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

numpy没有直接计算svd_lowrank的API,这个是复用了test_pca_lowrank的代码,是不是直接在test_pca_lowrank增加svd_lowrank测试案例更好一点

Copy link
Contributor

Choose a reason for hiding this comment

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

这样写也可以

@zhwesky2010 zhwesky2010 changed the title API improvement for paddle.linalg.svd_lowrank 易用性提升 API improvement for paddle.linalg.svd_lowrank Apr 2, 2024
zhwesky2010
zhwesky2010 previously approved these changes Apr 2, 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

Copy link

paddle-ci-bot bot commented Apr 3, 2024

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

@zhwesky2010
Copy link
Contributor

@NKNaN 看一下CI未通过的原因

@luotao1
Copy link
Contributor

luotao1 commented Apr 3, 2024

@zhwesky2010 是超过7天,Paddle-bot自动标记fail了,重新rerun或者merge下develop就好了

zero or more batch dimensions. N and M can be arbitrary positive number.
The data type of ``x`` should be float32 or float64.
q (int, optional): A slightly overestimated rank of :math:`X`.
Default value is :math:`q=min(6,N,M)`.
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的默认值,和在函数定义 def svd_lowrank(x, q=None, niter=2, M=None, name=None):q=None 是不是冲突了?辛苦看一下

Copy link
Contributor Author

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

@luotao1 luotao1 merged commit 5188ef5 into PaddlePaddle:develop Apr 7, 2024
30 checks passed
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Apr 9, 2024
* add svd lowrank api

* add test

* fix param M

* fix test timeout

* update docs
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.

4 participants