Skip to content

Conversation

@Caogration
Copy link
Contributor

PR Category

CINN

PR Types

Others

Description

Add unpool op.

@paddle-bot
Copy link

paddle-bot bot commented Aug 29, 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 Aug 29, 2024
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 30, 2024
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]));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

删掉symbol::DimExpr()

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

Comment on lines 1603 to 1615
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."));
}
}
Copy link
Contributor

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无关

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

if (shape_or_data.data().has_value()) {
output_size_expr = shape_or_data.data().value();
} else {
output_size_expr = shape_or_data.shape();
Copy link
Contributor

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);

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

Comment on lines 1608 to 1615
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."));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

不需要判断这里可以是符号或者表达式,不需要判断int

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

const std::vector<int> &ksize = details::GetVectorAttr<int>(op, "ksize");

const auto &attributes = op->attributes();
std::vector<int64_t> output_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里直接声明成std::vectorsymbol::DimExpr

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

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");
Copy link
Contributor

Choose a reason for hiding this comment

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

取出来后转成DimExpr吧,这样就统一了,下面不需要output_size_expr了

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

@gongshaotian
Copy link
Contributor

pre-commit 一下,codestyle 挂了

@luotao1 luotao1 merged commit 3f48373 into PaddlePaddle:develop Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants