Skip to content

[paddle.linalg.qr] Add the Qr Operator #35742

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

Merged
merged 21 commits into from
Oct 19, 2021
Merged

Conversation

aoyulong
Copy link
Contributor

@aoyulong aoyulong commented Sep 15, 2021

PR types

New features

PR changes

OPs

Describe

Add paddle.linalg.qr() function, Qr Op and Qr GPU/CPU kernel.
Note: Qr Op of this pull request doesn't have the backward kernels for now.
qr

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

fuyinno4
fuyinno4 previously approved these changes Sep 22, 2021
def qr(x, mode="reduced", name=None):
r"""
Computes the QR decomposition of one matrix or batches of matrice.
Args:
Copy link
Contributor

Choose a reason for hiding this comment

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

args 之前加一个空行

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.

If mode = "r", qr will return a tensor which represents R.

Examples:
import paddle
Copy link
Contributor

Choose a reason for hiding this comment

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

import paddle 之前需要加入:.. code-block:: python
参考文档:http://agroup.baidu.com/paddlepaddle/md/article/3088623

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.

dingjiaweiww
dingjiaweiww previously approved these changes Sep 23, 2021
@@ -504,6 +505,7 @@
'sqrt',
'cholesky',
'matrix_power',
'qr',
Copy link
Contributor

Choose a reason for hiding this comment

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

线性代数API 不需要在paddle.* 下面暴露

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.

@aoyulong aoyulong dismissed stale reviews from dingjiaweiww and fuyinno4 via 640915a September 23, 2021 07:07
dingjiaweiww
dingjiaweiww previously approved these changes Sep 23, 2021
@@ -105,6 +105,7 @@
from .tensor.linalg import slogdet # noqa: F401
from .tensor.linalg import multi_dot # noqa: F401
from .tensor.linalg import matrix_power # noqa: F401
from .tensor.linalg import qr # noqa: F401
Copy link
Contributor

Choose a reason for hiding this comment

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

should not add this line, otherwise we have paddle.qr

Superjomn
Superjomn previously approved these changes Sep 26, 2021
Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

compute_q = false;
reduced = true;
} else {
PADDLE_ENFORCE(
Copy link
Contributor

Choose a reason for hiding this comment

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

仅CUDA Kernel内的PADDLE_ENFORCE不需要加报错类型,这里也是需要加类型的,而且这里我理解用PADDLE_THROW更合适一些

class QrGradKernel : public framework::OpKernel<T> {
public:
void Compute(const framework::ExecutionContext& ctx) const {
PADDLE_ENFORCE(
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

zhiqiu
zhiqiu previously approved these changes Sep 26, 2021
Copy link
Contributor

@zhiqiu zhiqiu 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 ShareDataWith

TCChenlong
TCChenlong previously approved these changes Sep 26, 2021
zhhsplendid
zhhsplendid previously approved these changes Sep 26, 2021
Copy link
Member

@zhhsplendid zhhsplendid left a comment

Choose a reason for hiding this comment

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

Discussed that ShareDataWith should not be applied on output tensers, but we are chasing release/2.2 so I will approve this PR and we will change in future PRs

chenwhql
chenwhql previously approved these changes Sep 26, 2021
Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

临近打tag,先approve,希望后面追加PR规范报错检查的使用

Copy link
Contributor

@jzhang533 jzhang533 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
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LG API

@paddle-bot-old
Copy link

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

@JZ-LIANG JZ-LIANG merged commit 34d785c into PaddlePaddle:develop Oct 19, 2021
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.