-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
"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.", |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class TestMatrixRankAtolRtolEmptyTensor(unittest.TestCase): | |
class TestMatrixRankAtolRtolZeroSizeTensor(unittest.TestCase): |
"be 0, but shape is %s now.", | ||
dim_x)); | ||
if (x.numel() == 0) { | ||
out->Resize({0}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
假设输入的形状是[..., m, n],输出的形状应该是[...],而不是[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Category
User Experience
PR Types
Bug fixes
Description
解决matrix_rank不支持0 size 的问题
