Skip to content

[0-size Tensor No.159、161、163] Add 0-size Tensor support for conv1d - #73691

Merged
luotao1 merged 3 commits into
PaddlePaddle:developfrom
co63oc:f61
Jul 1, 2025
Merged

luotao1 merged 3 commits into
PaddlePaddle:developfrom
co63oc:f61

Conversation

@co63oc

@co63oc co63oc commented Jun 28, 2025 •

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

paddle.nn.functional.conv1d
paddle.nn.functional.conv2d
paddle.nn.functional.conv3d

Infermeta 去掉维度为0检查,如果filter_dims[1] 为0,结果对应维度设置为0,原有代码是设置filter_dims[0],符号推导同样修改。
修改kernel,只用判断input 维度为0
torch不支持单独filter设置为0维度
image

kernel 使用到depthwise_conv 和 conv kernel, 修改 depthwise_conv 和 conv kernel

正向测试返回填充为0,需要修改tester/accuracy.py输出结果, PaddleAPITest 对输入增加了pad

python engine.py --accuracy=True --api_config='paddle.nn.functional.conv3d(Tensor([4, 3, 8, 0, 8],"float32"), Tensor([5, 3, 3, 3, 3],"float32"), None, padding=list[list[0,0,],list[0,0,],list[1,1,],list[2,2,],list[2,2,],], stride=1, dilation=1, groups=1, data_format="NCDHW", )'

反向测试filter为填充0

import torch
x=torch.randn([0,1,1])
y=torch.randn([1,1,1])
x.requires_grad=True
y.requires_grad=True
z=torch.nn.functional.conv1d(x, y, groups=1)
z.sum().backward()
y.grad

tensor([[[0.]]])

PaddleAPITest 测试
GPU测试为torch error
image
image

CPU测试为torch error
image
image

@paddle-bot

paddle-bot Bot commented Jun 28, 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 28, 2025
@co63oc
co63oc force-pushed the f61 branch 2 times, most recently from 1ce0521 to 298d01a Compare June 28, 2025 08:02
@codecov-commenter

codecov-commenter commented Jun 28, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@3efb8db). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...interface/infer_symbolic_shape/binary_infer_sym.cc 66.66% 2 Missing ⚠️
paddle/phi/infermeta/binary.cc 85.71% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (76.92%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #73691   +/-   ##
==========================================
  Coverage           ?   76.92%           
==========================================
  Files              ?        2           
  Lines              ?       13           
  Branches           ?        0           
==========================================
  Hits               ?       10           
  Misses             ?        3           
  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.

@co63oc

co63oc commented Jun 30, 2025

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jun 30, 2025

@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

@DanielSun11

Copy link
Copy Markdown
Contributor

涉及到符号推导的改动请 @luotao1 协调云飞看一下

@luotao1
luotao1 merged commit 8e5a730 into PaddlePaddle:develop Jul 1, 2025
@co63oc
co63oc deleted the f61 branch July 10, 2025 05:41
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.

5 participants