Skip to content

[0-size Tensor Job2 No.66] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops]#73880

Merged
DanielSun11 merged 1 commit intoPaddlePaddle:developfrom
co63oc:g46
Jul 16, 2025
Merged

[0-size Tensor Job2 No.66] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops]#73880
DanielSun11 merged 1 commit intoPaddlePaddle:developfrom
co63oc:g46

Conversation

@co63oc
Copy link
Contributor

@co63oc co63oc commented Jul 7, 2025

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

66 paddle.nn.functional.softmax_with_cross_entropy

soft_label 为False时,axis 所在列不能为0,其他列相同,所以 softmax, loss的numel 都为0,这里判断softmax 的numel为0
https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/softmax_with_cross_entropy_cn.html#softmax-with-cross-entropy
image

PaddleAPITest 测试通过,错误为numpy error
image

55 paddle.nn.functional.cross_entropy - part
soft_label 为True时,loss维度中axis所在列设置为1,返回填充0
其中,在python端,如果reduction为mean,返回填充需要修改为nan,因为需要调试性能问题,这部分没有修改,在其他PR再修改
PaddleAPITest 测试通过,错误为numpy error
image

@paddle-bot
Copy link

paddle-bot bot commented Jul 7, 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 Jul 7, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jul 7, 2025
@co63oc
Copy link
Contributor Author

co63oc commented Jul 8, 2025

/re-run all-failed

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2025

Codecov Report

Attention: Patch coverage is 30.00000% with 7 lines in your changes missing coverage. Please review.

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

Files with missing lines Patch % Lines
paddle/phi/kernels/cpu/cross_entropy_kernel.cc 14.28% 6 Missing ⚠️
...addle/phi/kernels/cpu/cross_entropy_grad_kernel.cc 66.66% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (30.00%) 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   #73880   +/-   ##
==========================================
  Coverage           ?   30.00%           
==========================================
  Files              ?        2           
  Lines              ?       10           
  Branches           ?        0           
==========================================
  Hits               ?        3           
  Misses             ?        7           
  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 Jul 8, 2025

/re-run all-failed

2 similar comments
@co63oc
Copy link
Contributor Author

co63oc commented Jul 9, 2025

/re-run all-failed

@co63oc
Copy link
Contributor Author

co63oc commented Jul 14, 2025

/re-run all-failed

@co63oc co63oc changed the title [0-size Tensor Job2 No.66] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops] [0-size Tensor Job2 No.66、55] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops] Jul 15, 2025
@co63oc co63oc closed this Jul 15, 2025
@co63oc co63oc reopened this Jul 15, 2025
@co63oc co63oc changed the title [0-size Tensor Job2 No.66、55] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops] [0-size Tensor Job2 No.66] Add 0-size Tensor support for paddle.nn.functional.softmax_with_cross_entropy[fluid_ops] Jul 15, 2025
@co63oc
Copy link
Contributor Author

co63oc commented Jul 15, 2025

/re-run all-failed

1 similar comment
@co63oc
Copy link
Contributor Author

co63oc commented Jul 16, 2025

/re-run all-failed

@co63oc
Copy link
Contributor Author

co63oc commented Jul 16, 2025

@DanielSun11 CI已完成需要review

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 DanielSun11 merged commit 4b55ef8 into PaddlePaddle:develop Jul 16, 2025
79 of 81 checks passed
@co63oc co63oc deleted the g46 branch July 17, 2025 05:55
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