Skip to content
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

[NewIR]Add more gen api #56291

Merged
merged 1 commit into from
Aug 15, 2023
Merged

[NewIR]Add more gen api #56291

merged 1 commit into from
Aug 15, 2023

Conversation

0x45f
Copy link
Contributor

@0x45f 0x45f commented Aug 15, 2023

PR types

Others

PR changes

Others

Description

  • 为了不再阻塞其他工作,添加部分自动生成的API
  • 本PR中支持了多返回值API的生成,下面是reshape API的生成
std::tuple<ir::OpResult, ir::OpResult> reshape(ir::OpResult x, const std::vector<int64_t>& shape);

std::tuple<ir::OpResult, ir::OpResult> reshape(ir::OpResult x, const std::vector<int64_t>& shape){
    paddle::dialect::ReshapeOp reshape_op = APIBuilder::Instance().GetBuilder()->Build<paddle::dialect::ReshapeOp>(x, shape);
    return std::make_tuple(reshape_op.result(0), reshape_op.result(1));
}
  • 对于split类的API,需要等待builtin中的SliceOp完善后才能够生成
  • 下个PR预计会打开所有API的自动生成,或者有一个黑名单,只有少部分API不生成

Pcard-67164

@paddle-bot
Copy link

paddle-bot bot commented Aug 15, 2023

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

@zhangbo9674
Copy link
Contributor

可变 attribute 在 api 组网一层怎么处理?

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

LGTM

'sum',
'divide',
'full',
'tanh_grad',
Copy link
Contributor

Choose a reason for hiding this comment

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

后续这个API LIST 可以考虑单独一个文件。

@0x45f
Copy link
Contributor Author

0x45f commented Aug 15, 2023

可变 attribute 在 api 组网一层怎么处理?

目前没有特殊处理可变attr,那个api有可变attr呢?我看下生成的结果

@Aurelius84
Copy link
Contributor

可变 attribute 在 api 组网一层怎么处理?

目前没有特殊处理可变attr,那个api有可变attr呢?我看下生成的结果

@zhangbo9674 @0x45f 如线下讨论,这个我们可以在Python C 那一层里通过 PyArg2XX 或者 Py_IsInstance 做判断,来进行参数类型的解析。

@0x45f 0x45f merged commit bcc5ce4 into PaddlePaddle:develop Aug 15, 2023
@0x45f 0x45f deleted the add-more-api branch August 15, 2023 09:31
@0x45f 0x45f changed the title Add more gen api [NewIR]Add more gen api Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants