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

【Prim】Optimize composite rule by making scalar shape as 1 #51960

Merged
merged 9 commits into from
Mar 28, 2023

Conversation

JiabinYang
Copy link
Contributor

@JiabinYang JiabinYang commented Mar 22, 2023

PR types

Performance optimization

PR changes

Others

Describe

Pcard-66975
This PR Optimize prim performance by remove additional full shape

@JiabinYang JiabinYang changed the title 【Prim】Optimize composite rule by making scalar shape as []1 【Prim】Optimize composite rule by making scalar shape as 1 Mar 22, 2023
Copy link
Contributor

@xiaoguoguo626807 xiaoguoguo626807 left a comment

Choose a reason for hiding this comment

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

LGTM

one = ones(x.shape, x.dtype)
half = full(x.shape, 0.5, x.dtype)
full_shape = x.shape if len(x.shape) == 0 else [1]
one = ones(full_shape, x.dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

len(x.shape) == 0 this condition won't exist, better to check other same places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0D cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

0D cases

Copy link
Contributor

@cyber-pioneer cyber-pioneer left a comment

Choose a reason for hiding this comment

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

LGTM

@xiaoguoguo626807 xiaoguoguo626807 merged commit 45acb71 into PaddlePaddle:develop Mar 28, 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.

3 participants