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

【BUPT】【Paddle Tensor 第二期 API支持 0-size Tensor】paddle.matrix_rank 支持 0-size tensor #70130

Merged
merged 13 commits into from
Dec 16, 2024

Conversation

ZHOU05030
Copy link
Contributor

@ZHOU05030 ZHOU05030 commented Dec 11, 2024

PR Category

User Experience

PR Types

Bug fixes

Description

解决matrix_rank不支持0 size 的问题
image

Copy link

paddle-bot bot commented Dec 11, 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 Dec 11, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Dec 12, 2024
Comment on lines 98 to 104
"be 0, but shape is %s now.",
dim_x));
PADDLE_ENFORCE_NE(
cols,
0,
errors::InvalidArgument("The input Tensor x's shape[-1] should not "
"be 0, but shape is %s now.",
Copy link
Contributor

Choose a reason for hiding this comment

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

but shape is --> but received

@@ -474,5 +476,70 @@ def test_errors(self):
paddle.linalg.matrix_rank(x, tol=0.2, hermitian=True, rtol=0.2)


class TestMatrixRankAtolRtolEmptyTensor(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class TestMatrixRankAtolRtolEmptyTensor(unittest.TestCase):
class TestMatrixRankAtolRtolZeroSizeTensor(unittest.TestCase):

"be 0, but shape is %s now.",
dim_x));
if (x.numel() == 0) {
out->Resize({0});
Copy link
Contributor

Choose a reason for hiding this comment

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

假设输入的形状是[..., m, n],输出的形状应该是[...],而不是[0]

Copy link
Contributor

@HydrogenSulfate HydrogenSulfate left a comment

Choose a reason for hiding this comment

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

LGTM

@HydrogenSulfate HydrogenSulfate merged commit 66b19d3 into PaddlePaddle:develop Dec 16, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants