Skip to content

[CINN]add InferSymbolicShape for flatten#65624

Merged
Hongqing-work merged 1 commit intoPaddlePaddle:developfrom
Hongqing-work:add-flatten-infer-shape
Jul 2, 2024
Merged

[CINN]add InferSymbolicShape for flatten#65624
Hongqing-work merged 1 commit intoPaddlePaddle:developfrom
Hongqing-work:add-flatten-infer-shape

Conversation

@Hongqing-work
Copy link
Contributor

PR Category

CINN

PR Types

Bug fixes

Description

Pcard-67164
This PR fixes bug mentioned in PR65523 by adding InferSymbolicShape for flatten and moves ApplyShapeOptimizationPass before ApplyPdToCinnPass.

@paddle-bot
Copy link

paddle-bot bot commented Jul 2, 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.

Comment on lines +353 to +361
symbol::DimExpr outer{1};
std::vector<symbol::DimExpr> out_shape;
out_shape.reserve(in_dims_size - stop_axis + start_axis + 1);
for (int i = 0; i < start_axis; ++i) {
out_shape.push_back(x_shape[i]);
}
for (int i = start_axis; i <= stop_axis; i++) {
outer = outer * x_shape[i];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

这里 * 1 的表达式会自动化简掉吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

会自动化简的

@Hongqing-work Hongqing-work merged commit 6c4a37b into PaddlePaddle:develop Jul 2, 2024
@Hongqing-work Hongqing-work deleted the add-flatten-infer-shape branch July 18, 2024 08:56
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