CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【Infer Symbolic Shape No.175】【BUAA】Add unfold ops #67751
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
const symbol::ShapeOrDataDimExprs &x_shape_or_data = | ||
infer_context->GetShapeOrDataForValue(op->operand_source(0)); | ||
|
||
auto in_shapes = x_shape_or_data.shape(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 规范问题,尽量不使用auto,使用的话尽量使用const auto &
- 命名与上述不一致,推荐: x_shape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
std::vector<int> paddings = | ||
paddle::dialect::details::GetVectorAttr<int>(op, "paddings"); | ||
std::vector<int> dilations = | ||
paddle::dialect::details::GetVectorAttr<int>(op, "dilations"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些变量能否使用const std::vector &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以,Done
"The `dilations` should be greater than zero, " | ||
"but received dilations_height: %d dilations_width: %d.", | ||
dilations[0], | ||
dilations[1])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删除上述6个GT 0的检查,符号推导不能直接与int比较,再理解一下DimExpr是如何抽象表示的维度的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
int output_height = 0; | ||
int output_width = 0; | ||
if (in_shapes[2].dyn_cast<int64_t>() == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要判断dim是否是-1(动态sim)了,DimExpr能直接参与计算
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
out_shapes.push_back(in_shapes[1] * kernel_sizes[0] * kernel_sizes[1]); | ||
|
||
int output_height = 0; | ||
int output_width = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个变量声明成DimExpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
output_height = (in_shapes[2].dyn_cast<int64_t>() + paddings[0] + | ||
paddings[2] - dkernel_height) / | ||
strides[0] + | ||
1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个计算逻辑抽象成一个lambda表达式吧,下面也能复用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
paddings[3] - dkernel_width) / | ||
strides[1] + | ||
1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Category
CINNPR Types
OthersDescription
Add unfold ops.