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.svd_lowrank 易用性提升 #6562

Merged
merged 5 commits into from
Apr 7, 2024

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Mar 30, 2024

Copy link

paddle-bot bot commented Mar 30, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6562.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

| niter | - | 表示子空间进行迭代的数量。Paddle 无此参数,暂无转写方式。 |
| M | - | 表示输入 Tensor 的平均 size。 Paddle 无此参数,暂无转写方式。 |
| - | full_matrics | 表示是否计算完整的 U 和 V 矩阵。 PyTorch 无此参数,Paddle 保持默认即可。 |
| q | q | 表示输入 Tensor 略高估计秩,PyTorch 为 6,Paddle 为 None,Paddle 需设置为与 PyTorch 一致。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

infoflow 2024-04-01 16-26-21

看paddle代码里,如果q为None的话也是视作6来参与计算,因此这里是不是只有表面上不一致?底层其实是一致的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

底层是一致的

@@ -20,6 +20,7 @@ pca_lowrank
- **x** (Tensor) - 输入的需要进行线性主成分分析的一个或一批方阵,类型为 Tensor。 ``x`` 的形状应为 ``[*, M, N]``,其中 ``*`` 为零或更大的批次维度,数据类型支持 float32, float64。
- **q** (int,可选) - 对输入 :math:`X` 的秩稍微高估的预估值,默认值是 :math:`q=min(6,N,M)`。
- **center** (bool,可选) - 是否对输入矩阵进行中心化操作,类型为 bool ,默认为 True。
- **niter** (int) - 需要进行的子空间迭代次数。默认值为 2。
Copy link
Collaborator

Choose a reason for hiding this comment

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

torch.pca_lowrank的差异对比文档是不是也有问题?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

torch.pca_lowrank的差异对比文档里面写了niter,没有问题

::::::::::::

- **x** (Tensor) - 输入的需要进行奇异值分解的一个或一批方阵,类型为 Tensor。 ``x`` 的形状应为 ``[*, M, N]``,其中 ``*`` 为零或更大的批次维度,数据类型支持 float32, float64。
- **q** (int,可选) - 对输入 :math:`X` 的秩稍微高估的预估值,默认值是 None,此时 ``q`` 将取 :math:`q=min(6,N,M)`。
Copy link
Collaborator

Choose a reason for hiding this comment

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

q是否视作6,可以直接写简明一些

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
Collaborator

@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
Collaborator

@NKNaN code style检查的CI挂了

::::::::::::

- **x** (Tensor) - 输入的需要进行奇异值分解的一个或一批方阵,类型为 Tensor。 ``x`` 的形状应为 ``[*, M, N]``,其中 ``*`` 为零或更大的批次维度,数据类型支持 float32, float64。
- **q** (int,可选) - 对输入 :math:`X` 的秩稍微高估的预估值,默认值为 6。
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议和前面的 q=None 统一一下描述吧,尽量减少用户的理解成本,比如 默认值为 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
Collaborator

@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 6223798 into PaddlePaddle:develop Apr 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants