-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatibility No.360] Improve Cpp sink mechanism and sink paddle.inverse to cpp -part #77078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Compatibility No.360] Improve Cpp sink mechanism and sink paddle.inverse to cpp -part #77078
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
/re-run all-failed |
| """, | ||
| ) | ||
|
|
||
| add_doc_and_signature( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以往这个文件里的中间插入,不然PR容易前后自己冲突。
zhwesky2010
left a comment
There was a problem hiding this 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( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些都是用于c++下沉的
python/paddle/tensor/math.py
Outdated
| out_res, _ = paddle.static.nn.while_loop( | ||
| _gcd_cond_fn, _gcd_body_fn, [x, y] | ||
| ) | ||
| if out is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上下两个out分支可以合并下处理
python/paddle/tensor/math.py
Outdated
|
|
||
| @param_two_alias(['x', 'input'], ['y', 'other']) | ||
| def gcd(x: Tensor, y: Tensor, name: str | None = None) -> Tensor: | ||
| @ParamAliasDecorator({"x": ["input"], "y": ["other"]}) |
There was a problem hiding this comment.
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
Co-authored-by: Nyakku Shigure <[email protected]>
Co-authored-by: Nyakku Shigure <[email protected]>
|
/re-run all-failed |
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
冲突需要重新处理下。
|
@Manfredss 这个下沉后有些case无法通过了,你本地测试下看什么问题。 |
这个测试文件里为什么是 @pytest.mark.api_linalg_det_vartype 而不是 @pytest.mark.api_linalg_inv_vartype? if isfunction(func)判断改为 if isfunction(func) or callable(func) and not hasattr(func, '__mro__')使其能够正确识别 |
在paddle/_init_.py最后会
|
我看看 |
那 linalg.py 中也得改吧 |
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
问题描述CI 测试中会有 CE-Framework 测试失败,经过本地测试复现失败: pytest PaddleTest/framework/api/linalg/test_inv.py这是由于 paddle.linalg.inv 未定义造成的 问题拆解
if prefix == "paddle.":
paddle_func_map.append(...)
elif prefix == "paddle.Tensor.":
tensor_method_map.append(...)
elif prefix == "paddle.nn.functional.":
nn_func_map.append(...)
else:
raise Exception("Unsupported Prefix " + prefix, "API : " + name)这意味着即使在 解决方案生成器增强:扩展 monkey_patch_gen.py 以支持通用模块路径
优点: 未来添加类似路径的 API,如 修改文件
修改后测试:python paddle/test/legacy_test/test_inverse_op.py # 测试通过
pytest PaddleTest/framework/api/linalg/test_inv.py # 测试通过 |
|
/re-run all-failed |
python/paddle/linalg.py
Outdated
| ) | ||
|
|
||
|
|
||
| def __getattr__(name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样能解决一个单点的API导入问题。
但这个是一个共性的问题,后续比如这里的
cholesky,
cholesky_inverse,
cholesky_solve,
如果下沉也都会遇到类似的问题,调研下更通用的解决方案,参考:
- 修改patch顺序,提前
monkey_patch_generated_methods_for_tensor的位置 - 修改
monkey_patch_generated_methods_for_tensor逻辑,目前只会根据python_api_info.yaml里的paddle.*来配置patch,如果这个name支持paddle.linalg.inv或任意其他路径的patch也能解决问题
paddle/fluid/eager/auto_code_generator/generator/monkey_patch_gen.py
Outdated
Show resolved
Hide resolved
paddle/fluid/eager/auto_code_generator/generator/monkey_patch_gen.py
Outdated
Show resolved
Hide resolved
| method_name = name.split(".")[ | ||
| -1 | ||
| ] # Extract the method name from full path | ||
| if prefix == "paddle.": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体合并成一套逻辑,这一块整体重构,不用在之前局限的设计上 打补丁
|
/re-run all-failed |
|
请先不要rerun IXUCA, 预计今天修复,明天rebase此分支到develop即可 |
|
可以rebase到develop,重跑CI看下 |
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM




PR Category
User Experience
PR Types
New features
Description
Sink paddle.inverse to cpp
Add param alias for x
Add new param out