From 3f1d0234ae13f3ad35b61452fa3da6d536183991 Mon Sep 17 00:00:00 2001 From: "joanna.wozna.intel" Date: Thu, 19 Sep 2019 15:16:23 +0200 Subject: [PATCH] Fix conv2d+dequantize squash for residual fusion (#19545) * Fix conv2d+dequantize squash for residual fusion test=develop * Change condition test=develop --- paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc index ac9ad7937a..1e23539c80 100644 --- a/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc @@ -177,7 +177,10 @@ void CPUQuantizeSquashPass::ConvDequantSquash(Graph* graph) const { GET_IR_NODE_FROM_SUBGRAPH(dequant_out, dequant_out, conv_dequant_pattern); // if conv2d has one output - if (conv_out->outputs.size() == 1) { + // and there is no fuse residual connection + // because residual fusion does not support force output with fp32 + if (conv_out->outputs.size() == 1 && + !(conv_op->Op()->GetAttrIfExists("fuse_residual_connection"))) { conv_op->Op()->SetAttr("force_fp32_output", true); conv_op->Op()->SetOutput("Output", std::vector({dequant_out->Name()})); -- GitLab