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

[CINN] Add Convert0DTo1DPass #61656

Merged
merged 3 commits into from
Feb 8, 2024

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Feb 6, 2024

PR types

New features

PR changes

Others

Description

pcard-76996

[CINN] Add Convert0DTo1DPass

进入 CINN 的 Tensor 输入可能为 0D-Tensor,如果 0D-Tensor 的处理从 CINN 前端贯穿到后端,需要补足的机制较多,因此暂时添加 Convert0DTo1DPass,将进入到 CINN 的 Tensor 处理为 1D-Tensor。长远来看,有充足人力时,应该去掉这个 pass,CINN 原生支持 0D-Tensor 的处理。

PS:目前只发现了通过 FullOp 创建 0D-Tensor 的例子,因此 pass 内仅对 FullOp 做 PatternMatch

Before:

(%2) = "pd_op.full" () {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(cpu),shape:(pd_op.IntArray)[],stop_gradient:[true],value:(Float)2} : () -> pd_op.tensor<f32>

After:

(%2) = "pd_op.full" () {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(cpu),shape:(pd_op.IntArray)[1],stop_gradient:[true],value:(Float)2} : () -> pd_op.tensor<1xf32>

Copy link

paddle-bot bot commented Feb 6, 2024

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

@tc20042008 tc20042008 merged commit 5f00cf8 into PaddlePaddle:develop Feb 8, 2024
30 checks passed
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.

2 participants