From f0f6f49ea476b6b81a0885f8f31b6d4619a87759 Mon Sep 17 00:00:00 2001 From: chenyemeng Date: Wed, 30 Dec 2020 17:16:40 +0800 Subject: [PATCH] add switch/merge pass in graph prepare --- ge/graph/passes/switch_dead_branch_elimination.cc | 2 -- ge/graph/preprocess/graph_preprocess.cc | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ge/graph/passes/switch_dead_branch_elimination.cc b/ge/graph/passes/switch_dead_branch_elimination.cc index 9358c9c3..70105aea 100644 --- a/ge/graph/passes/switch_dead_branch_elimination.cc +++ b/ge/graph/passes/switch_dead_branch_elimination.cc @@ -18,8 +18,6 @@ #include #include -#include "common/ge_inner_error_codes.h" -#include "common/types.h" #include "framework/common/debug/ge_log.h" #include "graph/common/omg_util.h" #include "graph/passes/pass_utils.h" diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 32f877cf..c9bf61f3 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -53,6 +53,7 @@ #include "graph/passes/hccl_group_pass.h" #include "graph/passes/identity_pass.h" #include "graph/passes/infershape_pass.h" +#include "graph/passes/merge_pass.h" #include "graph/passes/net_output_pass.h" #include "graph/passes/no_use_reshape_remove_pass.h" #include "graph/passes/parallel_concat_start_op_pass.h" @@ -68,6 +69,7 @@ #include "graph/passes/shape_operate_op_remove_pass.h" #include "graph/passes/snapshot_pass.h" #include "graph/passes/stop_gradient_pass.h" +#include "graph/passes/switch_dead_branch_elimination.h" #include "graph/passes/unused_const_pass.h" #include "graph/passes/var_is_initialized_op_pass.h" #include "graph/passes/variable_prepare_op_pass.h" @@ -1606,6 +1608,10 @@ Status GraphPrepare::InferShapeForPreprocess() { if (!options_.train_graph_flag) { names_to_passes.emplace_back("AssertPass", &assert_pass); } + SwitchDeadBranchElimination switch_dead_branch_elimination; + names_to_passes.emplace_back("SwitchDeadBranchElimination", &switch_dead_branch_elimination); + MergePass merge_pass; + names_to_passes.emplace_back("MergePass", &merge_pass); InferShapePass infer_shape_pass; names_to_passes.emplace_back("InferShapePass", &infer_shape_pass); ReplaceWithEmptyConstPass replace_with_empty_const_pass;