Skip to content

[API Compatibility No.109、110 ] sink log10 and log1p into c++ -part#76381

Merged
luotao1 merged 8 commits intoPaddlePaddle:developfrom
zade23:log10_log1p
Nov 18, 2025
Merged

[API Compatibility No.109、110 ] sink log10 and log1p into c++ -part#76381
luotao1 merged 8 commits intoPaddlePaddle:developfrom
zade23:log10_log1p

Conversation

@zade23
Copy link
Copy Markdown
Contributor

@zade23 zade23 commented Nov 12, 2025

PR Category

User Experience

PR Types

New features

Description

下沉paddle.log10、paddle.log1p 到C++层。

  • 兼容torch input参数
  • 增加out参数支持

任务:#76301
PaConvert:PaddlePaddle/PaConvert#755

Copilot AI review requested due to automatic review settings November 12, 2025 09:50
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Nov 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.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 12, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates paddle.log10 and paddle.log1p functions from Python to C++ implementation to improve performance and maintainability. The changes add PyTorch-compatible input parameter aliasing and introduce out parameter support for in-place operations.

Key changes:

  • Removed Python implementations of log10 and log1p from python/paddle/tensor/math.py
  • Added comprehensive API documentation with signatures to python/paddle/_paddle_docs.py
  • Added API mapping configuration in paddle/phi/ops/yaml/python_api_info.yaml
  • Added compatibility test suites covering both dygraph and static modes with multiple parameter patterns

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/legacy_test/test_activation_op.py Added comprehensive test classes TestLog10APICompatibility and TestLog1pAPI_Compatibility to verify parameter compatibility, tensor methods, and output parameter functionality
python/paddle/tensor/math.py Removed Python implementations of log10 and log1p functions (now implemented in C++) and updated imports
python/paddle/_paddle_docs.py Added detailed documentation and signatures for log10 and log1p functions including math formulas, parameters, return values, and usage examples
paddle/phi/ops/yaml/python_api_info.yaml Registered log10 and log1p operations with Python API mappings for both module-level and tensor method access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


.. math::

Out = \log_{10}x
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

[nitpick] The LaTeX formatting in the math block has inconsistent underscore usage. The formula should use proper subscript formatting:

Out = \log_{10}x

should be:

Out = \log_{10}{x}

to properly group the base and the argument, or use parentheses for clarity:

Out = \log_{10}(x)
Suggested change
Out = \log_{10}x
Out = \log_{10}{x}

Copilot uses AI. Check for mistakes.
Comment thread test/legacy_test/test_activation_op.py Outdated
Comment thread test/legacy_test/test_activation_op.py Outdated
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 12, 2025

Codecov Report

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

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

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Nov 13, 2025
@luotao1 luotao1 changed the title [API compatibility No.109、110 ] sink log10 and log1p into c++ [API compatibility No.109、110 ] sink log10 and log1p into c++ -part Nov 13, 2025
@zhwesky2010 zhwesky2010 changed the title [API compatibility No.109、110 ] sink log10 and log1p into c++ -part [API compatibility No.109、110 ] sink log10 and log1p into c++ Nov 13, 2025
@zhwesky2010 zhwesky2010 changed the title [API compatibility No.109、110 ] sink log10 and log1p into c++ [API compatibility No.109、110 ] sink log10 and log1p into c++ -part Nov 13, 2025
@luotao1 luotao1 changed the title [API compatibility No.109、110 ] sink log10 and log1p into c++ -part [API Compatibility No.109、110 ] sink log10 and log1p into c++ -part Nov 13, 2025
Copy link
Copy Markdown
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

@luotao1
Copy link
Copy Markdown
Contributor

luotao1 commented Nov 14, 2025

@zade23 需要解决下流水线问题

@zade23
Copy link
Copy Markdown
Contributor Author

zade23 commented Nov 14, 2025

/re-run all-failed

1 similar comment
@zade23
Copy link
Copy Markdown
Contributor Author

zade23 commented Nov 15, 2025

/re-run all-failed

@zade23
Copy link
Copy Markdown
Contributor Author

zade23 commented Nov 15, 2025

关于CI

Static-Check

API签名发生了变化,但没审批。

# 旧签名
paddle.Tensor.log10(x, name)
paddle.Tensor.log1p(x, name)

# 新签名(增加了out参数)
paddle.Tensor.log10(x, name, *, out=None)
paddle.Tensor.log1p(x, name, *, out=None)

Slice Test

失败的测试用例:

- Getitem - forward - Slice - Tuple of Slices - float16 - paddle: -16.58%
- SetitemTensor - forward - Slice - Tuple of Slices - float32 - paddle: -14.01%
- Getitem - forward - None - Combined with Integers for Expansion - float16 - paddle: -11.59%
... (其他slice相关测试)

我的改动应该不涉及slice操作

该CI已通过

@zade23
Copy link
Copy Markdown
Contributor Author

zade23 commented Nov 15, 2025

/re-run all-failed

@luotao1 luotao1 merged commit a774636 into PaddlePaddle:develop Nov 18, 2025
181 of 196 checks passed
LittleHeroZZZX pushed a commit to LittleHeroZZZX/Paddle that referenced this pull request Nov 19, 2025
…addlePaddle#76381)

* sink log10 and log1p into c++

* Update test/legacy_test/test_activation_op.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/legacy_test/test_activation_op.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants