From 85f708e620a1f57268aec8228d0180d30023b41a Mon Sep 17 00:00:00 2001 From: zhangzhaoju Date: Fri, 26 Mar 2021 09:42:29 +0800 Subject: [PATCH] nlp transformer bug fix TODO: need opt the pyobj free process, now has memleak problem --- mindspore/ccsrc/pipeline/pynative/pynative_execute.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc index 52ed9aabd5a..afb30d8cbff 100644 --- a/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pipeline/pynative/pynative_execute.cc @@ -1751,10 +1751,11 @@ void GradExecutor::InitResourceAndDfBuilder(const std::string &cell_id, const py PushCellStack(cell_id); // Init kPynativeCellPtr with input parameters of top cell if (!top_cell()->is_init_kpynative()) { - auto graph_info = std::make_shared(cell_id); - top_cell()->graph_info_map()[curr_g_] = graph_info; + auto graph_info_cg = std::make_shared(cell_id); + top_cell()->graph_info_map()[curr_g_] = graph_info_cg; auto df_builder = GetDfbuilder(cell_id); - top_cell()->graph_info_map()[df_builder] = graph_info; + auto graph_info_df = std::make_shared(cell_id); + top_cell()->graph_info_map()[df_builder] = graph_info_df; // Init paramter info for make cnode and curr_g for (size_t i = 0; i < args.size(); ++i) { auto param = args[i]; @@ -2110,7 +2111,8 @@ FuncGraphPtr GradExecutor::GetBpropGraph(const GradOperationPtr &grad, const std MS_EXCEPTION_IF_NULL(grad); auto k_pynative_cell_ptr = top_cell()->k_pynative_cell_ptr(); MS_EXCEPTION_IF_NULL(k_pynative_cell_ptr); - auto bprop_graph = ad::GradPynativeCellEnd(k_pynative_cell_ptr, weights, grad->get_all_, grad->get_by_list_); + auto bprop_graph = ad::GradPynativeCellEnd(k_pynative_cell_ptr, weights, grad->get_all_, grad->get_by_list_, + grad->sens_param_); MS_EXCEPTION_IF_NULL(bprop_graph); MS_LOG(DEBUG) << "Top graph input params size " << arg_size;