CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【Infer Symbolic Shape No.176】【BUAA】Add unpool op #67818
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提交成功,感谢你对开源项目的贡献! |
std::vector<symbol::DimExpr> output_shape = {x_shape[0], x_shape[1]}; | ||
for (size_t i = 0; i < ksize.size(); ++i) { | ||
output_shape.emplace_back(symbol::DimExpr(output_size[i])); | ||
} |
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.
删掉symbol::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
if (shape_or_data.data().has_value()) { | ||
output_size_expr = shape_or_data.data().value(); | ||
} else { | ||
output_size_expr = shape_or_data.shape(); | ||
} | ||
for (const auto &output_size_i : output_size_expr) { | ||
if (output_size_i.isa<int64_t>()) { | ||
output_size.emplace_back(output_size_i.dyn_cast<int64_t>()); | ||
} else { | ||
PADDLE_THROW(common::errors::InvalidArgument( | ||
"The type of output_size must be int64, please check.")); | ||
} | ||
} |
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.
1、output_size允许是符号表达式,不需要检查output_size_i.isa<int64_t>())
2、output_size_expr = shape_or_data.shape();
为错误使用,这里和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
if (shape_or_data.data().has_value()) { | ||
output_size_expr = shape_or_data.data().value(); | ||
} else { | ||
output_size_expr = 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.
改为:details::GetOrCreateExprVecFromData(shape_or_data,infer_context);
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
for (const auto &output_size_i : output_size_expr) { | ||
if (output_size_i.isa<int64_t>()) { | ||
output_size.emplace_back(output_size_i.dyn_cast<int64_t>()); | ||
} else { | ||
PADDLE_THROW(common::errors::InvalidArgument( | ||
"The type of output_size must be int64, please check.")); | ||
} | ||
} |
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.
不需要判断这里可以是符号或者表达式,不需要判断int
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
const std::vector<int> &ksize = details::GetVectorAttr<int>(op, "ksize"); | ||
|
||
const auto &attributes = op->attributes(); | ||
std::vector<int64_t> output_size; |
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.
这里直接声明成std::vectorsymbol::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
const auto &attributes = op->attributes(); | ||
std::vector<int64_t> output_size; | ||
if (attributes.find("output_size") != attributes.end()) { | ||
output_size = details::GetVectorAttr<int64_t>(op, "output_size"); |
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吧,这样就统一了,下面不需要output_size_expr了
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
pre-commit 一下,codestyle 挂了 |
PR Category
CINNPR Types
OthersDescription
Add unpool op.