Skip to content

[API compatibility NO.88]Sinking lgamma into C++ -part#78212

Merged
luotao1 merged 6 commits intoPaddlePaddle:developfrom
cvbret:develop
Mar 11, 2026
Merged

[API compatibility NO.88]Sinking lgamma into C++ -part#78212
luotao1 merged 6 commits intoPaddlePaddle:developfrom
cvbret:develop

Conversation

@cvbret
Copy link
Contributor

@cvbret cvbret commented Mar 7, 2026

PR Category

Operator Mechanism

PR Types

Improvements

Description

  1. 新增 lgamma 的参数别名映射配置
    - 在 paddle/phi/ops/yaml/python_api_info.yaml 增加:

    • op: lgamma
    • name: [paddle.lgamma, paddle.Tensor.lgamma]
    • args_alias.use_default_mapping: True(支持 input -> x
  2. 下沉 Python 实现到 C++ 调度

    • python/paddle/tensor/math.py_C_ops 导入列表中加入 lgamma
    • 删除原有 def lgamma(...) 的 Python 逻辑实现,统一走 C++ 侧参数解析与调度
  3. 补充 API 文档与签名

    • python/paddle/_paddle_docs.py 增加 add_doc_and_signature("lgamma", ...)
    • 补充 Alias: input 说明
    • 补充 out 参数与 Keyword args 描述,签名更新为带 out 的形式
  4. 新增兼容性测试

    • test/legacy_test/test_api_compatibility.py 增加 TestLgammaAPI
    • 覆盖动态/静态图、Paddle 位置参数、Paddle 关键字参数、PyTorch 别名关键字参数、混合参数、Tensor 方法调用、out(动态图)及异常参数校验
  5. 验证

    • 增量编译通过:cmake .. && make -j$(nproc)
    • 单测通过:`python test/legacy_test/test_api_compatibility.py

是否引起精度变化

@CLAassistant
Copy link

CLAassistant commented Mar 7, 2026

CLA assistant check
All committers have signed the CLA.

@paddle-bot
Copy link

paddle-bot bot commented Mar 7, 2026

你的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

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@paddle-bot paddle-bot bot added the contributor External developers label Mar 7, 2026
@cvbret cvbret changed the title 任务88,完成对函数lgamma的API兼容性增强,Update python_api_info.yaml and test_api_compatibility.py and math.py… [API compatibility NO.88]Sinking lgamma into C++ Mar 7, 2026
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.

删除掉 setup-checkpoint.py 这个文件的修改

@cvbret
Copy link
Contributor Author

cvbret commented Mar 8, 2026

请问现在可以了吗@zhwesky2010

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 9, 2026
@luotao1
Copy link
Contributor

luotao1 commented Mar 9, 2026

冲突了

@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2026

Codecov Report

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

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

)

# Exception parameters
with self.assertRaises(ValueError):
Copy link
Contributor

Choose a reason for hiding this comment

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

这些不用测

# Mixed arguments
out5 = paddle.lgamma(x, name=None)

exe = paddle.static.Executor(paddle.CPUPlace())
Copy link
Contributor

Choose a reason for hiding this comment

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

去掉CPUPlace

paddle_dygraph_out.append(out4)

# Mixed arguments
out5 = paddle.lgamma(x, name=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

name全部不用测试

paddle_dygraph_out.append(out8)

# Tensor method - kwargs
out9 = x.lgamma(name=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

精简下测试,name全部忽略

# Tensor method
out4 = x.lgamma()
# Mixed arguments
out5 = paddle.lgamma(x, name=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

精简下测试,name全部忽略,压缩下测试行数

x (Tensor): Input Tensor. Must be one of the following types: bfloat16, float16, float32, float64,
uint8, int8, int16, int32, int64. Alias: ``input``.
name (str|None, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
out (Tensor, optional): The output Tensor. If set, the result will be stored in this Tensor. Default: None.
Copy link
Contributor

Choose a reason for hiding this comment

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

out重复了,这里删掉

@cvbret cvbret requested a review from zhwesky2010 March 10, 2026 00:52
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 requested a review from SigureMo March 10, 2026 12:11
@luotao1 luotao1 merged commit 71b1207 into PaddlePaddle:develop Mar 11, 2026
145 of 148 checks passed
@luotao1 luotao1 changed the title [API compatibility NO.88]Sinking lgamma into C++ [API compatibility NO.88]Sinking lgamma into C++ -part Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Compatibility contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants