-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 more rules to cinn_to_pd_op pass #64354
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
::pir::IrMapping& ir_mapping, // NOLINT | ||
::pir::Builder& builder) { // NOLINT | ||
VLOG(6) << "transform " << op->name() << " from cinn_op to pd_op"; | ||
auto attrs = op->attributes(); |
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 attrs = op->attributes(); | |
const auto& attrs = op->attributes(); |
避免map的copy
VLOG(6) << "transform " << op->name() << " from cinn_op to pd_op"; | ||
auto attrs = op->attributes(); | ||
|
||
float scale = attrs.at("scale").dyn_cast<::pir::FloatAttribute>().data(); |
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.
float scale = attrs.at("scale").dyn_cast<::pir::FloatAttribute>().data(); | |
const float scale = attrs.at("scale").dyn_cast<::pir::FloatAttribute>().data(); |
可以养成const的习惯
::pir::IrMapping& ir_mapping, // NOLINT | ||
::pir::Builder& builder) { // NOLINT | ||
VLOG(6) << "transform " << op->name() << " from cinn_op to pd_op"; | ||
auto attrs = op->attributes(); |
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.
同上,对于不需要修改attrs的转换规则,建议使用const &,下面的函数也可以系统性看下
* add more rules to cinn_to_pd_op pass * update
* add more rules to cinn_to_pd_op pass * update
PR Category
CINN
PR Types
Improvements
Description
Pcard-67164
为cinn op到pd op的转换添加更多规则