From 5996bd39e89085214da1e7bc161525c1eb4e88d5 Mon Sep 17 00:00:00 2001 From: Tomasz Patejko Date: Tue, 18 Sep 2018 03:26:27 +0200 Subject: [PATCH] MKLDNN conv + elementwise_add fusion: graph is corrected based on actual argument name, not formal argument name --- .../ir/conv_elementwise_add_mkldnn_fuse_pass.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 1ede53f468..c3454ea7a6 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()); + }); } } } -- GitLab