Skip to content

[0-size Tensor No.112] Add 0-size Tensor support for multi_dot - #73122

Merged
wanghuancoder merged 3 commits into
PaddlePaddle:developfrom
co63oc:b67
Jun 11, 2025
Merged

wanghuancoder merged 3 commits into
PaddlePaddle:developfrom
co63oc:b67

Conversation

@co63oc

@co63oc co63oc commented Jun 6, 2025 •

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Improvements

Description

删除文件中重复版权

修改前向和反向
infermeta没有修改
kernel 使用impl中实现,前向和反向都在一个文件
multi_dot 修改impl中调用

PaddleAPITest 测试torch error
image

@paddle-bot

paddle-bot Bot commented Jun 6, 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.

@paddle-bot paddle-bot Bot added the contributor External developers label Jun 6, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jun 6, 2025
Comment thread test/legacy_test/test_multi_dot_op.py Outdated
class TestMultiDotOp_ZeroSize(TestMultiDotOp):
def init_shape(self):
self.A_shape = (2, 0)
self.B_shape = (0, 4)

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.

多加几个单测,验证一下(可能需要三个及以上矩阵连乘)

  • out 的numel不为0,但是某一个x的 numel为0的情况,其他x的numel不为0
  • out 的numel0,但是存在x的numel不为0的情况

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已增加,结果维度是开始的维度和结尾的维度
image

for (size_t i = 0; i < n; i++) {
if (dx[i]->numel() > 0) {
phi::Full<T, Context>(
ctx, phi::IntArray(common::vectorize(dx[i]->dims())), 0, dx[i]);

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.

新增的单测case 覆盖不到此处

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已增加
image

@luotao1

luotao1 commented Jun 9, 2025

Copy link
Copy Markdown
Collaborator

请解决下冲突

@DanielSun11 DanielSun11 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 0f7ed8f into PaddlePaddle:develop Jun 11, 2025
shanjiang7 pushed a commit to shanjiang7/Paddle that referenced this pull request Jun 12, 2025
@co63oc
co63oc deleted the b67 branch June 30, 2025 10:29
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.

4 participants