add_env_eliminate_pass_for_run_control_flow_with_ms_function

This commit is contained in:
7347157+joylvliang@user.noreply.gitee.com 2021-09-02 19:20:56 +08:00
parent 321813038c
commit d3b856f19a
1 changed files with 7 additions and 0 deletions

View File

@ -191,8 +191,15 @@ FuncGraphPtr BpropGraphFinalOptPass(const ResourcePtr &res) {
{"ad_final_opt", bg_final_opt},
{"zeros_like", fill_zeros_like},
});
if (pynative::PynativeExecutor::GetInstance()->grad_executor()->need_renormalize()) {
map.emplace_back(std::make_pair("renormalize", opt::OptPassConfig::Renormalize()));
opt::OptPassConfig env_eliminate = opt::OptPassConfig({
irpass.incorporate_call_,
irpass.incorporate_call_switch_,
irpass.incorporate_getitem_set_,
});
map.emplace_back(std::make_pair("env_eliminate", env_eliminate));
}
auto bprop_graph_final_opt = opt::Optimizer::MakeOptimizer("bprop_graph_final_opt", res, map);