未验证 提交 040d3386 编写于 作者: L Leo Chen 提交者: GitHub

fix bug that some op has no op_role attr (#41040)

上级 17af293f
...@@ -422,8 +422,11 @@ void CheckVarHasNanOrInf(const std::string& op_type, ...@@ -422,8 +422,11 @@ void CheckVarHasNanOrInf(const std::string& op_type,
bool IsSkipOp(const framework::OperatorBase& op) { bool IsSkipOp(const framework::OperatorBase& op) {
if (op_type_nan_inf_white_list().count(op.Type()) != 0) return true; if (op_type_nan_inf_white_list().count(op.Type()) != 0) return true;
int op_role = op.template Attr<int>( int op_role = 0;
framework::OpProtoAndCheckerMaker::OpRoleAttrName()); if (op.HasAttr(framework::OpProtoAndCheckerMaker::OpRoleAttrName())) {
op_role = op.template Attr<int>(
framework::OpProtoAndCheckerMaker::OpRoleAttrName());
}
// kForward=0, can't filter // kForward=0, can't filter
if (op_role == static_cast<int>(framework::OpRole::kForward)) { if (op_role == static_cast<int>(framework::OpRole::kForward)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册