From fdbfdc56a5cb2f96c1dc66a087acc1c1b663361b Mon Sep 17 00:00:00 2001 From: yuchaojie Date: Sat, 26 Jun 2021 11:37:47 +0800 Subject: [PATCH] fix bnupdate_eltwise_eltwise_fusion_pass --- .../bnupdate_eltwise_eltwise_fusion_pass.cc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/mindspore/ccsrc/backend/optimizer/ascend/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc b/mindspore/ccsrc/backend/optimizer/ascend/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc index 0752f90be0e..435c65ed021 100644 --- a/mindspore/ccsrc/backend/optimizer/ascend/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc +++ b/mindspore/ccsrc/backend/optimizer/ascend/buffer_fusion/bnupdate_eltwise_eltwise_fusion_pass.cc @@ -28,20 +28,6 @@ namespace mindspore { namespace opt { -namespace { -constexpr size_t kEltwiseInputSize = 2; -constexpr size_t kEltwiseOutputSize = 2; -bool CheckEltwiseInputAndOutputSize(const AnfNodePtr &node) { - if (AnfAlgo::GetInputTensorNum(node) == kEltwiseInputSize) { - return true; - } - if (AnfAlgo::GetOutputTensorNum(node) == kEltwiseOutputSize) { - return true; - } - return false; -} -} // namespace - void BnupdateEltwiseEltwiseFusionPass::MatchBnupdateAddRelu(const CNodePtr &cnode, const AnfNodePtr &relu_input, const session::KernelGraph &kernel_graph, FusedNodeRecord *candidate_fusion) { @@ -82,7 +68,8 @@ void BnupdateEltwiseEltwiseFusionPass::MatchSingleFusionPattern(const session::K auto cnode = node->cast(); MS_EXCEPTION_IF_NULL(cnode); if (AnfAlgo::GetKernelType(cnode) == KernelType::TBE_KERNEL && - AnfAlgo::GetFusionType(cnode) == kernel::FusionType::ELEMWISE && CheckEltwiseInputAndOutputSize(cnode)) { + AnfAlgo::GetFusionType(cnode) == kernel::FusionType::ELEMWISE && + AnfAlgo::GetOutputTensorNum(cnode) == ELTWISE_DOUBLE_OUTPUT_SIZE) { auto eltwise_input = cnode->input(kIndex1); MS_EXCEPTION_IF_NULL(eltwise_input); if (eltwise_input->isa() && AnfAlgo::CheckPrimitiveType(eltwise_input, prim::kPrimAdd)) {