Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

[0D-Tensor] Add ExpandZeroDimPass, support 0D input and output #1428

Merged
merged 9 commits into from
May 22, 2023

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented May 15, 2023

[0D-Tensor] Add ExpandZeroDimPass, support 0D input and output

Note: What does ExpandZeroDimPass do?

Expand all 0D-Tensor (both inputs and outputs) to 1D-Tensor. To change the 0D-Tensor back when we fetch outputs, this PR records the 0D outputs Tensor's name before ExpandZeroDimPass.

Note: Why register program pass instead of graph pass?

In the beginning, I try to register ExpandZeroDimPass as the first graph pass to handle 0D-Tensor, however, before the graph passes, the program passes such as Decomposer will change instructions with 0D-Tensor input.

Such change is not what we want, and adapting the program pass with ExpandZeroDimPass will introduce a lot of redundant codes which couple program pass and graph pass. So I register ExpandZeroDimPass as the first program pass in this PR.

@paddle-bot
Copy link

paddle-bot bot commented May 15, 2023

Thanks for your contribution!

Copy link
Collaborator

@thisjiang thisjiang left a comment

Choose a reason for hiding this comment

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

在python/tests/passes目录下加个python端的Pass测试吧

cinn/frontend/decomposer/broadcast.cc Show resolved Hide resolved
@jiahy0825
Copy link
Contributor Author

在python/tests/passes目录下加个python端的Pass测试吧

Done

Copy link
Collaborator

@thisjiang thisjiang left a comment

Choose a reason for hiding this comment

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

LGTM

@thisjiang thisjiang merged commit 941ebc8 into PaddlePaddle:develop May 22, 2023
jiahy0825 added a commit to jiahy0825/CINN that referenced this pull request May 25, 2023
…ePaddle#1428)

* [0D-Tensor] Add ExpandZeroDimPass, support 0D input and output

* Change graph pass to program pass, enable unit test of pass

* polish codes

* change year, 2021->2023

* Change CI paddle version 2.4.2->develop

* disable paddle temporarily

* Restore paddle version in this PR

* add python unittest of pass
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants