-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatible ]Provide mechanical support for the Python API to sink to the C++ layer #74601
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
wanghuancoder
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补充
XiaoguangHu01
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
| python_api : | ||
| name : [paddle.amax,paddle.Tensor.amax] | ||
| args_alias: | ||
| x : [input,x1] | ||
| axis : [dim] |
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.
这里的配置信息有点多,感觉需要做一些信息压缩
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.
好!计划增加一些默认规则的转换,比如x和input以及dim和axis的对应关系,这些非常通用的对应关系就不需要在yaml中显示的写出了
PR Category
Operator Mechanism
PR Types
New features
Description
API C++ 下沉方案机制建设。
为了解决装饰器方案开销较大的问题,制定了API下沉至C++层的方案,该方案在C++层面实现了:
整体改动:
修改python_c code Gen的生成逻辑。在
paddle/fluid/pybind/eager_op_function.cc以及paddle/fluid/pybind/static_op_function.cc中的代码生成时添加对 参数解析(关键字传参、组合传参)、参数映射(参数重命名)、默认值处理(python api的默认值下沉到C++处理)、自定义处理逻辑(应对复杂的参数映射场景、在python中对参数的预处理场景)utils功能增强。
paddle/fluid/pybind/eager_utils.ccpaddle/fluid/pybind/op_function_common.cc中新增了部分用于从args和kwargs里取参数的函数,以及对一些PyObject转C++ 数据类型的一些utils增加了默认值设置功能。文档与api绑定。新增python/paddle/_paddle_docs.py 用于存放/注册下沉后的API的文档,新增_add_docstr 用于为下称后的C++ API绑定API。
新增monkey pacth自动生成功能。主要用于将下沉后的C++ API注册为Tensor/Value 的method。
ops yaml 格式的新增映射条目 。 增加python_api映射条目,用于描述对应的python API,参数别名、自定义处理逻辑的接口。
pcard-67164