Skip to content

[0-size Tensor Job2 No.2、3、10] Add 0-size Tensor support for equal_all [fluid_ops]#73550

Merged
DanielSun11 merged 8 commits intoPaddlePaddle:developfrom
co63oc:f43
Jul 4, 2025
Merged

[0-size Tensor Job2 No.2、3、10] Add 0-size Tensor support for equal_all [fluid_ops]#73550
DanielSun11 merged 8 commits intoPaddlePaddle:developfrom
co63oc:f43

Conversation

@co63oc
Copy link
Contributor

@co63oc co63oc commented Jun 23, 2025

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

2 paddle.add_n
修改infermeta, 符号推导,如果多个维度中有一个维度为0,结果维度设置为0,如果都不为0,比较是否相等
修改前向,如果输出维度为0返回
增加单测
PaddleAPITest中是对输入broadcast后使用torch.stack实现
image

PaddleAPITest 测试通过
image

3 paddle.bincount
修改infermeta,符号推导,如果输入维度为0,不比较weight对应维度是否相同
修改kernel,如果输入维度为0,输出大小为minlength,同时用0填充

PaddleAPITest测试通过
image

10 paddle.equal_all
修改kernel,如果x numel为0,填充True,kernel已有shape是否相等的判断
torch返回为True

import
torch.equal(torch.randn([2,0,3]), torch.randn([2,0,3]))

True

PaddleAPITest测试通过
image

@paddle-bot
Copy link

paddle-bot bot commented Jun 23, 2025

你的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 23, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jun 23, 2025
@co63oc co63oc changed the title [0-size Tensor Job2 No.10] Add 0-size Tensor support for equal_all [0-size Tensor Job2 No.2、3、10] Add 0-size Tensor support for equal_all Jun 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2025

Codecov Report

Attention: Patch coverage is 65.38462% with 9 lines in your changes missing coverage. Please review.

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

Files with missing lines Patch % Lines
paddle/phi/kernels/cpu/bincount_kernel.cc 0.00% 3 Missing ⚠️
...interface/infer_symbolic_shape/binary_infer_sym.cc 0.00% 2 Missing ⚠️
...terface/infer_symbolic_shape/multiary_infer_sym.cc 80.00% 2 Missing ⚠️
paddle/phi/infermeta/multiary.cc 83.33% 1 Missing ⚠️
paddle/phi/kernels/cpu/compare_kernel.cc 50.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (65.38%) 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   #73550   +/-   ##
==========================================
  Coverage           ?   65.38%           
==========================================
  Files              ?        7           
  Lines              ?       26           
  Branches           ?        0           
==========================================
  Hits               ?       17           
  Misses             ?        9           
  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
Copy link
Contributor Author

co63oc commented Jun 29, 2025

/re-run all-failed

np.testing.assert_allclose(static_out[0], infer_out)


class TestBincountOp_ZeroSize(TestBincountOp):
Copy link
Contributor

Choose a reason for hiding this comment

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

TestBincountOp的def test_check_output(self): self.check_output(check_pir=True, check_symbol_infer=False) 。没有检查symbol_infer导致覆盖不到paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/binary_infer_sym.cc:285新增的代码。请重载这个方法并开启check_symbol_infer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
bincount使用的是out_unknown,在kernel运行时推导shape,check_symbol_infer设置为True是失败

@co63oc
Copy link
Contributor Author

co63oc commented Jul 2, 2025

/re-run all-failed

@co63oc co63oc changed the title [0-size Tensor Job2 No.2、3、10] Add 0-size Tensor support for equal_all [0-size Tensor Job2 No.2、3、10] Add 0-size Tensor support for equal_all [fluid_ops] Jul 2, 2025
@co63oc
Copy link
Contributor Author

co63oc commented Jul 2, 2025

/re-run all-failed

Copy link
Contributor

@DanielSun11 DanielSun11 left a comment

Choose a reason for hiding this comment

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

LGTM

@DanielSun11
Copy link
Contributor

涉及到infer_symbolic_shape的修改,请 @luotao1 协调云飞再次review

@DanielSun11 DanielSun11 merged commit 8132805 into PaddlePaddle:develop Jul 4, 2025
114 of 123 checks passed
@co63oc co63oc deleted the f43 branch July 10, 2025 05:40
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