diff --git a/paddle/fluid/framework/ir/xpu/fc_xpu_fuse_pass.cc b/paddle/fluid/framework/ir/xpu/fc_xpu_fuse_pass.cc index 59e7f4f7de59bdde009839a427742496b1cbc309..4c8424b7df08fd33e868c0e3a4e9f4580082b75f 100644 --- a/paddle/fluid/framework/ir/xpu/fc_xpu_fuse_pass.cc +++ b/paddle/fluid/framework/ir/xpu/fc_xpu_fuse_pass.cc @@ -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;