Skip to content

Commit

Permalink
[XPU] Fix matmul + elementwise_add + bn + act fusion that elementwise…
Browse files Browse the repository at this point in the history
…_add has branch. (#56578)
  • Loading branch information
csy0225 committed Aug 24, 2023
1 parent 1c0db09 commit e9bb312
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paddle/fluid/framework/ir/xpu/fc_xpu_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ FcXPUPattern::FcXPUPattern(PDPattern* pattern,
add_out = pattern->NewNode(add_out_repr())
->assert_is_op_output("elementwise_add", "Out")
->assert_var_not_persistable();
if (with_bn_ || !act_type_.empty()) {
add_out->assert_has_n_outputs(1);
}
add->LinksFrom({mul_out, bias}).LinksTo({add_out});
} else {
add_out = mul_out;
Expand Down

0 comments on commit e9bb312

Please sign in to comment.