Skip to content

Conversation

@hushenwei2000
Copy link
Contributor

@hushenwei2000 hushenwei2000 commented Aug 14, 2025

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

Currently, the cumsum kernel exhibits different output types between PyTorch and Paddle. For instance, when the input datatype is int8/int16/int32, PyTorch outputs int64, whereas Paddle outputs the origin datatype.

This PR

  • Addde type cast in Python level API.

pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Aug 14, 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.

@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@2beec18). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #74625   +/-   ##
==========================================
  Coverage           ?        0           
==========================================
  Files              ?        0           
  Lines              ?        0           
  Branches           ?        0           
==========================================
  Hits               ?        0           
  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.

@hushenwei2000
Copy link
Contributor Author

/re-run all-failed

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

  1. 如果Python端做了cast,那么unary.cc中的逻辑应该是不需要修改的
  2. uint16、uint32是不是也应该处理?
  3. 增加一个单测测试吧。

@hushenwei2000
Copy link
Contributor Author

  • 如果Python端做了cast,那么unary.cc中的逻辑应该是不需要修改的
  • uint16、uint32是不是也应该处理?
  • 增加一个单测测试吧。
  • 是的,unary.cc 里的更改已删除。
  • paddle 的所有 API 处理 uint16 都是使用 bfloat16 计算的,这应该不属于 output type diff 需要修复的范围;paddle 不支持 uint32 类型输入。
  • 单测已经添加。

@hushenwei2000
Copy link
Contributor Author

/re-run all-failed

@hushenwei2000
Copy link
Contributor Author

/re-run all-failed

@swgu98 swgu98 merged commit b040e89 into PaddlePaddle:develop Aug 20, 2025
225 of 238 checks passed
Luckycheng222 pushed a commit to Luckycheng222/Paddle that referenced this pull request Aug 25, 2025
…sum API (PaddlePaddle#74625)

* fix(math.py, unary.cc): fix output type diff for cumsum kernel

* fix(math.py): fix output type diff for cumsum kernel

* fix(math.py): fix `cumsum` documentation

* fix(cum/cum_grad.cc/cu, test_cumsum_op.py): fix output type diff for cumsum kernel and add unit test
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.

4 participants