未验证 提交 65805227 编写于 作者: Z Zhanlue Yang 提交者: GitHub

Fixed automatic codegen issues with grad attr_map (#39358)

上级 5c3873f6
...@@ -64,6 +64,11 @@ static bool IgnoreGradAttribute(const std::string& op_type, ...@@ -64,6 +64,11 @@ static bool IgnoreGradAttribute(const std::string& op_type,
} }
} }
// Only allow SumOp
if (op_type != "sum") {
return true;
}
return false; return false;
} }
...@@ -1693,7 +1698,7 @@ static std::string GenerateSingleOpBase( ...@@ -1693,7 +1698,7 @@ static std::string GenerateSingleOpBase(
VLOG(6) << "Generated Outs Map"; VLOG(6) << "Generated Outs Map";
// [Generation] Get Attrs Map // [Generation] Get Attrs Map
const char* ATTRS_TEMPLATE = " auto %s = this->attr_map_;\n"; const char* ATTRS_TEMPLATE = " auto& %s = this->attr_map_;\n";
std::string grad_attrs_str = std::string grad_attrs_str =
paddle::string::Sprintf(ATTRS_TEMPLATE, attrs_name); paddle::string::Sprintf(ATTRS_TEMPLATE, attrs_name);
for (const auto& iter : grad_attrs) { for (const auto& iter : grad_attrs) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册