未验证 提交 c5341496 编写于 作者: W Wilber 提交者: GitHub

fix squared_mat_sub_fuse_pass when elementwise_op input is from persistable...

fix squared_mat_sub_fuse_pass when elementwise_op input is from persistable param test=develop (#20960)

fix squared_mat_sub_fuse_pass when elementwise_op input is from persistable param
上级 a6747a6e
...@@ -240,7 +240,8 @@ PDNode* BuildSquaredMatSubPattern(PDPattern* pattern, ...@@ -240,7 +240,8 @@ PDNode* BuildSquaredMatSubPattern(PDPattern* pattern,
return false; return false;
} }
for (auto* in : x->inputs) { for (auto* in : x->inputs) {
if (in && in->inputs[0] && is_fusion_sub_op(in->inputs[0])) { if (in && in->inputs.size() > 0 && in->inputs[0] &&
is_fusion_sub_op(in->inputs[0])) {
return true; return true;
} }
} }
...@@ -262,7 +263,7 @@ PDNode* BuildSquaredMatSubPattern(PDPattern* pattern, ...@@ -262,7 +263,7 @@ PDNode* BuildSquaredMatSubPattern(PDPattern* pattern,
auto* constant_op_out = pattern->NewNode( auto* constant_op_out = pattern->NewNode(
[=](Node* x) { [=](Node* x) {
return x && x->IsVar() && var_is_op_input(x, "elementwise_mul") && return x && x->IsVar() && var_is_op_input(x, "elementwise_mul") &&
x->inputs[0] && x->inputs[0]->IsOp() && x->inputs.size() > 0 && x->inputs[0] && x->inputs[0]->IsOp() &&
x->inputs[0]->Op()->Type() == "fill_constant" && x->outputs[0] && x->inputs[0]->Op()->Type() == "fill_constant" && x->outputs[0] &&
is_fusion_element_op(x->outputs[0]); is_fusion_element_op(x->outputs[0]);
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册