From f78110bf2579620560db95eaf2314dff39faa746 Mon Sep 17 00:00:00 2001 From: Margaret_wangrui Date: Mon, 18 May 2020 13:02:40 +0800 Subject: [PATCH] when parameter is not exist in child graph, create new parameter from parameter --- mindspore/ccsrc/session/ascend_session.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/session/ascend_session.cc b/mindspore/ccsrc/session/ascend_session.cc index fce65b28a..3a0595269 100644 --- a/mindspore/ccsrc/session/ascend_session.cc +++ b/mindspore/ccsrc/session/ascend_session.cc @@ -566,7 +566,7 @@ GraphId AscendSession::SetFinalGraphInput(const std::vector &args) { // if function return UINT_MAX,the parameter is not exist in child graph auto parameter_belong_graph_id = GetGraphIdByNode(parameter); if (parameter_belong_graph_id == kInvalidGraphId) { - parameter_backend = final_graph->NewParameter(parameter->cast()); + parameter_backend = CreateNewParameterFromParameter(parameter, true, final_graph.get()); final_graph->FrontBackendlMapAdd(parameter, parameter_backend); MS_LOG(INFO) << "New parameter" << parameter->DebugString() << "in final_graph"; } else { @@ -576,14 +576,14 @@ GraphId AscendSession::SetFinalGraphInput(const std::vector &args) { MS_LOG(INFO) << "Reuse parameter [" << parameter->DebugString() << "] of child graph [" << parameter_belong_graph_id << "]"; parameter_backend = graph->GetBackendAnfByFrontAnf(parameter); + // add parameter in backend to final graph inputs + auto final_graph_inputs = final_graph->MutableInputs(); + MS_EXCEPTION_IF_NULL(final_graph_inputs); + final_graph_inputs->push_back(parameter_backend); } MS_EXCEPTION_IF_NULL(parameter_backend); MS_LOG(INFO) << "parameter backend " << parameter_backend->DebugString() << " belong_graph_id " << AnfAlgo::GetGraphId(parameter_backend.get()); - // add parameter in backend to final graph inputs - auto final_graph_inputs = final_graph->MutableInputs(); - MS_EXCEPTION_IF_NULL(final_graph_inputs); - final_graph_inputs->push_back(parameter_backend); } MS_LOG(INFO) << "End final_graph_id " << final_graph_id_; return final_graph_id_; -- GitLab