diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc index 1ede53f46896344f5f3f74439d1af8430f878524..c3454ea7a69dcb5f0d5dff468bbea303c95537ad 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc @@ -118,7 +118,18 @@ void CorrectGraphEdges(Graph* graph, Node* from, Node* to) { if (same != std::end(node.inputs)) { LinkNodes(to, &node); - node.Op()->SetInput("X", {to->Name()}); + + auto inputs = node.Op()->Inputs(); + + std::for_each(std::begin(inputs), std::end(inputs), + [from, to](const std::pair>& i) -> void { + auto params = i.second; + + std::remove_if(std::begin(params), std::end(params), + std::bind(std::equal_to(), from->Name(), std::placeholders::_1)); + + params.push_back(to->Name()); + }); } } }