Skip to content

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

Merged
HydrogenSulfate merged 13 commits into
PaddlePaddle:developfrom
ZHOU05030:matrix_rank
Dec 16, 2024
Merged

HydrogenSulfate merged 13 commits into
PaddlePaddle:developfrom
ZHOU05030:matrix_rank

Conversation

@ZHOU05030

@ZHOU05030 ZHOU05030 commented Dec 11, 2024 •

Copy link
Copy Markdown
Contributor

PR Category

User Experience

PR Types

Bug fixes

Description

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

@paddle-bot

paddle-bot Bot commented Dec 11, 2024

Copy link
Copy Markdown

你的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
Copy Markdown
Collaborator

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

paddle.linalg.matrix_rank(x, tol=0.2, hermitian=True, rtol=0.2)


class TestMatrixRankAtolRtolEmptyTensor(unittest.TestCase):

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@HydrogenSulfate HydrogenSulfate left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

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