KEMBAR78
[API compatibility] update paddle divide divide_ add div div_ true_divide API by zhanghonggeng · Pull Request #74562 · PaddlePaddle/Paddle · GitHub
Skip to content

Conversation

@zhanghonggeng
Copy link
Contributor

@zhanghonggeng zhanghonggeng commented Aug 12, 2025

PR Category

User Experience

PR Types

New features

Description

  1. paddle.divide :新增参数rounding_mode,out;输入映射x:input、y:other;y支持Nubmber类型。
    rounding_mode参数:支持None、'trunc'、'floor'三种类型的设置,其中'trunc' 为向0取整,'floor'为向负无穷取整;None时
    相当于true_divide。
  2. 新增API addle.div (paddle. divide 别名)。
  3. 新增API paddle.true_divide。
  4. 新增API paddle.Tensor.div_ 和 paddle.div_。

注:

  1. y 不单独支持 scalar,后续会统一支持。
  2. int类型提升(转换规则:整数与浮点运算时,结果只需满足浮点精度。long_tensor + float_tensor → float32(无需float64)不单独支持,后续会统一支持。

pcard-67164

@paddle-bot
Copy link

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

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

  1. name参数都统一放到最后面,避免name参数处于参数列表的任意位置
  2. 已知共性问题:类型提升/二元支持scalar,目前不用单API中修改,paconvert也可注释不执行,这个会后续统一支持。如果这里的除法操作的类型调整,不是共性问题,就可以新增相应的逻辑。

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 38.63636% with 27 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@32069a5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/tensor/math.py 32.50% 27 Missing ⚠️

❌ Your patch status has failed because the patch coverage (38.63%) 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   #74562   +/-   ##
==========================================
  Coverage           ?   38.63%           
==========================================
  Files              ?        3           
  Lines              ?       44           
  Branches           ?        0           
==========================================
  Hits               ?       17           
  Misses             ?       27           
  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.

@zhanghonggeng
Copy link
Contributor Author

/re-run all-failed

@zhanghonggeng
Copy link
Contributor Author

/re-run all-failed

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 merged commit 6f3f875 into PaddlePaddle:develop Aug 18, 2025
173 of 189 checks passed
Luckycheng222 pushed a commit to Luckycheng222/Paddle that referenced this pull request Aug 25, 2025
…vide API (PaddlePaddle#74562)

* [API compatibility] update paddle divide divide_ add div div_ true_divide api

* update

* test

* update

* update

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants