Skip to content

[0-size Tensor No.111] Add 0-size Tensor support for paddle.linalg.matrix_rank API. - #72786

Merged
wanghuancoder merged 4 commits into
PaddlePaddle:developfrom
DanielSun11:fix_0-size_matrix_rank
May 23, 2025
Merged

wanghuancoder merged 4 commits into
PaddlePaddle:developfrom
DanielSun11:fix_0-size_matrix_rank

Conversation

@DanielSun11

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Improvements

Description

paddle.linalg.matrix_rank对0 size Tensor支持不够好,具体表现为PaddleAPITest报错。

这几个shape的Tensor在Torch中都是支持的。
4c070b786cdcc8f75f3c03522d6186d3

但是Paddle中报参数错误,原因在于 #70130 对paddle.linalg.matrix_rank的修复过程添加了不必要的限制,导致矩阵的shape存在0时就报错。因此对paddle.linalg.matrix_rank进行了重新修复。

具体修复过程:

  1. 检查infermeta推导(推导没问题)
  2. 修复kernel
  3. 检查其他device的kernel是否存在问题(只有cpu和gpu有对应的kernel)
  4. 检查反向(这个api无反向的过程)
  5. 添加单测以及使用PaddleAPITest 复测

Pcard-67164

@paddle-bot

paddle-bot Bot commented May 19, 2025

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.

@DanielSun11
DanielSun11 requested a review from wanghuancoder May 21, 2025 06:51
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@5883eef). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #72786   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         7           
  Branches           ?         0           
===========================================
  Hits               ?         7           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wanghuancoder wanghuancoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@wanghuancoder
wanghuancoder merged commit 5759bac into PaddlePaddle:develop May 23, 2025
@DanielSun11
DanielSun11 deleted the fix_0-size_matrix_rank branch September 18, 2025 06:25
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.

3 participants