!27 Rebuild graph before RunGraph if needed

Merge pull request !27 from Simson/master
This commit is contained in:
mindspore-ci-bot 2020-04-09 14:33:29 +08:00 committed by Gitee
commit 3bde6404de
2 changed files with 10 additions and 1 deletions

View File

@ -138,6 +138,13 @@ Status GraphRunner::RunGraph(const RunOptions& options, const std::vector<GeTens
return Status::FAILED;
}
// The information of some nodes could be changed after fusion in some cases
// Therefore a graph needs to be rebuilt in above situation
if (sess_->IsGraphNeedRebuild(wrap_ptr->id_)) {
sess_->RemoveGraph(wrap_ptr->id_);
sess_->AddGraph(wrap_ptr->id_, *(wrap_ptr->graph_ptr_), wrap_ptr->options_);
}
ge::Status ret = sess_->RunGraph(wrap_ptr->id_, ge_inputs, ge_outputs);
if (ret != ge::GRAPH_SUCCESS) {
MS_LOG(ERROR) << "Call GE RunGraph Failed, ret is: " << ret;

View File

@ -358,7 +358,9 @@ void MsContext::GetGeOptions(std::map<std::string, std::string>* ge_options) con
MS_LOG(ERROR) << "Set proto lib path failed!";
}
// Disbale the global variable acc, only enable it whlie adding training graph in pipeline
// Enable auto mixed precision according to the context options
(*ge_options)["ge.exec.auto_mix_precision"] = std::to_string(auto_mixed_precision_flag_);
// Disable the global variable acc, only enable it whlie adding training graph in pipeline
(*ge_options)["ge.exec.variable_acc"] = "0";
#endif
}