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 constraint for while op #64385

Merged
merged 2 commits into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions paddle/fluid/pir/dialect/operator/ir/control_flow_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -682,11 +682,22 @@ bool WhileOp::InferSymbolicShape(
input_arg_shape[j]);
continue;
}
if (original_input_shape.size() == yield_value_shape.size() &&
original_input_shape[j] == yield_value_shape[j]) {
infer_context->AddEqualCstr(original_input_shape[j],
input_arg_shape[j]);
continue;
if (original_input_shape.size() == yield_value_shape.size()) {
if (original_input_shape[j] == yield_value_shape[j]) {
infer_context->AddEqualCstr(original_input_shape[j],
input_arg_shape[j]);
continue;
}
symbol::DimExprBuilder builder;
if (yield_value_shape[j] ==
builder.Broadcast(input_arg_shape[j],
original_input_shape[j]) ||
yield_value_shape[j] == builder.Broadcast(original_input_shape[j],
input_arg_shape[j])) {
Comment on lines +692 to +696
Copy link
Contributor

Choose a reason for hiding this comment

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

按照约定。这个if的判断有点复杂了。使用lambda提炼一下,lambda变量名承载注释信息。

infer_context->AddEqualCstr(original_input_shape[j],
input_arg_shape[j]);
continue;
}
}
}
}
Expand Down