Skip to content

Conversation

@Manfredss
Copy link
Contributor

PR Category

User Experience

PR Types

New features

Description

Sink paddle.inverse to cpp
Add param alias for x
Add new param out

@paddle-bot
Copy link

paddle-bot bot commented Dec 24, 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 Dec 24, 2025
@codecov-commenter
Copy link

codecov-commenter commented Dec 25, 2025

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #77078   +/-   ##
===========================================
  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.

@Manfredss
Copy link
Contributor Author

/re-run all-failed

""",
)

add_doc_and_signature(
Copy link
Contributor

Choose a reason for hiding this comment

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

可以往这个文件里的中间插入,不然PR容易前后自己冲突。

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.

PR冲突了,_paddle_docs.py这个文件容易冲突。可以都往最后面加。

)


add_doc_and_signature(
Copy link
Contributor

Choose a reason for hiding this comment

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

gcd下沉了吗,没下沉直接在python api的位置维护文档和签名,这里不需要加。

)


add_doc_and_signature(
Copy link
Contributor

Choose a reason for hiding this comment

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

这些都是用于c++下沉的

out_res, _ = paddle.static.nn.while_loop(
_gcd_cond_fn, _gcd_body_fn, [x, y]
)
if out is not 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分支可以合并下处理


@param_two_alias(['x', 'input'], ['y', 'other'])
def gcd(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
@ParamAliasDecorator({"x": ["input"], "y": ["other"]})
Copy link
Contributor

Choose a reason for hiding this comment

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

这个装饰器性能要比param_two_alias差点,后面还是可以直接用param_two_alias

zhwesky2010
zhwesky2010 previously approved these changes Dec 26, 2025
@zhwesky2010 zhwesky2010 requested a review from SigureMo December 26, 2025 05:47
Co-authored-by: Nyakku Shigure <[email protected]>
SigureMo
SigureMo previously approved these changes Dec 26, 2025
@Manfredss
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.

冲突需要重新处理下。

zhwesky2010
zhwesky2010 previously approved these changes Jan 12, 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.

LGTM

SigureMo
SigureMo previously approved these changes Jan 12, 2026
@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Jan 13, 2026

@Manfredss 这个PR review已经没问题了,但是还有很多CI没有通过,尽快看下,不然阻碍无法合入。

@Manfredss Manfredss dismissed stale reviews from SigureMo and zhwesky2010 via 64e8528 January 14, 2026 21:16
@Manfredss
Copy link
Contributor Author

/re-run all-failed

@zhwesky2010
Copy link
Contributor

@Manfredss 冲突了

[[0.50000000, 0. ],
[0. , 0.50000000]])
""",
Copy link
Contributor

Choose a reason for hiding this comment

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

缩进不符合规范,参考目前其他的add_doc_and_signature


@param_two_alias(['x', 'input'], ['y', 'other'])
def gcd(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
@ParamAliasDecorator({"x": ["input"], "y": ["other"]})
Copy link
Contributor

Choose a reason for hiding this comment

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

这个不需要改了


@param_two_alias(['x', 'input'], ['y', 'other'])
def lcm(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
@ParamAliasDecorator({"x": ["input"], "y": ["other"]})
Copy link
Contributor

Choose a reason for hiding this comment

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

不需要改了

@param_two_alias(['x', 'input'], ['y', 'other'])
def gcd(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
@ParamAliasDecorator({"x": ["input"], "y": ["other"]})
def gcd(
Copy link
Contributor

Choose a reason for hiding this comment

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

out参数未覆盖

@Manfredss
Copy link
Contributor Author

/re-run all-failed

paddle.disable_static()
x = paddle.to_tensor(self.np_input)

# 使用所有支持的别名进行测试
Copy link
Contributor

Choose a reason for hiding this comment

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

代码库里不要加中文

@Manfredss
Copy link
Contributor Author

/re-run all-failed

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Jan 22, 2026

@Manfredss 这个下沉后有些case无法通过了,你本地测试下看什么问题。
https://github.com/PaddlePaddle/PaddleTest/blob/develop/framework/api/linalg/test_inv.py

CI-Build / CE-Framework / Test (pull_request) 测试结果失败:
infoflow 2026-01-22 12-14-35

@Manfredss
Copy link
Contributor Author

@Manfredss 这个下沉后有些case无法通过了,你本地测试下看什么问题。

这个测试文件里为什么是 @pytest.mark.api_linalg_det_vartype 而不是 @pytest.mark.api_linalg_inv_vartype?
然后应该要把 apibase.py 里的

if isfunction(func)

判断改为

if isfunction(func) or callable(func) and not hasattr(func, '__mro__')

使其能够正确识别 builtin_function_or_method 类型(如 paddle.linalg.inv)作为函数而不是类

@zhwesky2010
Copy link
Contributor

@Manfredss 这个下沉后有些case无法通过了,你本地测试下看什么问题。

这个测试文件里为什么是 @pytest.mark.api_linalg_det_vartype 而不是 @pytest.mark.api_linalg_inv_vartype? 然后应该要把 apibase.py 里的

if isfunction(func)

判断改为

if isfunction(func) or callable(func) and not hasattr(func, '__mro__')

使其能够正确识别 builtin_function_or_method 类型(如 paddle.linalg.inv)作为函数而不是类

在paddle/_init_.py最后会 monkey_patch_generated_methods_for_tensor,重新将公开API:paddle.*paddle.tensor.*F.* 换成有python接口的,而paddle.linalg.inv导入了原始的pybind的inverse。这里需要看看调整下这一系列导入方式。在patch完之后,再从from paddle.tensor import inverse as inv就没问题。

infoflow 2026-01-22 15-03-38

@Manfredss
Copy link
Contributor Author

@Manfredss 这个下沉后有些case无法通过了,你本地测试下看什么问题。

这个测试文件里为什么是 @pytest.mark.api_linalg_det_vartype 而不是 @pytest.mark.api_linalg_inv_vartype? 然后应该要把 apibase.py 里的

if isfunction(func)

判断改为

if isfunction(func) or callable(func) and not hasattr(func, '__mro__')

使其能够正确识别 builtin_function_or_method 类型(如 paddle.linalg.inv)作为函数而不是类

在paddle/init.py最后会 monkey_patch_generated_methods_for_tensor,重新将公开API:paddle.*paddle.tensor.*F.* 换成有python接口的,而paddle.linalg.inv导入了原始的pybind的inverse。这里需要看看调整下这一系列导入方式。在patch完之后,再从from paddle.tensor import inverse as inv就没问题。

infoflow 2026-01-22 15-03-38

我看看

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.

4 participants