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][PIR] group_norm decomposite rule support dynamic shape #62793

Merged
merged 7 commits into from
Mar 21, 2024

Conversation

zeroRains
Copy link
Contributor

PR types

New features

PR changes

Others

Description

support dynamic shape for group_norm

Copy link

paddle-bot bot commented Mar 17, 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.

@paddle-bot paddle-bot bot added the contributor External developers label Mar 17, 2024
self.init_x_shape = [None, 640, None, None]
self.x = np.random.random(self.x_shape).astype(self.dtype)
self.net = group_norm_net1
self.necessary_ops = "pd_op.flatten"
Copy link
Contributor

Choose a reason for hiding this comment

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

group_norm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Tensor x_shape = get_slice<T>(x_dim, 0) * groups;
Tensor dim_1 = full<T>({1}, -1, x_dim.type());
x_shape = concat<T>({x_shape, dim_1});
x_cast = backend::reshape<T>(x_cast, x_shape);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
x_cast = backend::reshape<T>(x_cast, x_shape);
x_cast = reshape<T>(x_cast, x_shape);

Tensor dim_1 = full<T>({1}, -1, x_dim.type());
x_shape = concat<T>({x_shape, dim_1});
x_cast = backend::reshape<T>(x_cast, x_shape);
mean_ = mean_decomp<T>(x_cast, IntArray(one_axis), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove IntArray

@cyber-pioneer cyber-pioneer merged commit 98f6c8c into PaddlePaddle:develop Mar 21, 2024
30 checks passed
@zeroRains zeroRains deleted the gn branch March 21, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants