diff --git a/mindspore/ccsrc/frontend/optimizer/auto_monad_eliminate.cc b/mindspore/ccsrc/frontend/optimizer/auto_monad_eliminate.cc index bb52dab7934..fea7e113516 100644 --- a/mindspore/ccsrc/frontend/optimizer/auto_monad_eliminate.cc +++ b/mindspore/ccsrc/frontend/optimizer/auto_monad_eliminate.cc @@ -165,7 +165,11 @@ void ReplaceLoadUserMakeTuple(const FuncGraphManagerPtr &manager, const FuncGrap (void)std::copy_if(make_tuple_inputs.begin(), make_tuple_inputs.end(), std::back_inserter(new_make_tuple_inputs), [load](const AnfNodePtr &input) { return load != input; }); const auto &new_make_tuple = fg->NewCNode(new_make_tuple_inputs); - new_make_tuple->set_abstract(make_tuple->abstract()); + // Set abstract for the MakeTuple node. + abstract::AbstractBasePtrList element_abstracts; + std::transform(new_make_tuple_inputs.begin() + 1, new_make_tuple_inputs.end(), std::back_inserter(element_abstracts), + [](const AnfNodePtr &input) { return input->abstract(); }); + new_make_tuple->set_abstract(std::make_shared(element_abstracts)); manager->Replace(make_tuple, new_make_tuple); } diff --git a/mindspore/ccsrc/pipeline/jit/static_analysis/order_enforce.cc b/mindspore/ccsrc/pipeline/jit/static_analysis/order_enforce.cc index cf1f6bd47ea..65d3bdc0c49 100644 --- a/mindspore/ccsrc/pipeline/jit/static_analysis/order_enforce.cc +++ b/mindspore/ccsrc/pipeline/jit/static_analysis/order_enforce.cc @@ -107,6 +107,9 @@ class OrderEnforcer { const size_t input_size = update_state->inputs().size(); for (size_t index = attach_index; index < input_size; index++) { auto attach = update_state->input(attach_index); + if (attach == load_user) { + return true; + } if (IsPrimitiveCNode(attach, prim::kPrimMakeTuple)) { auto attach_cnode = attach->cast(); auto inputs = attach_cnode->inputs(); @@ -115,8 +118,6 @@ class OrderEnforcer { if (has_load_user) { return true; } - } else if (attach == load_user) { - return true; } } return false; @@ -126,7 +127,7 @@ class OrderEnforcer { void AddInputEdges(const CNodePtr &update_state, const std::unordered_set &load_users) { auto sorted_load_users = SortLoadUsers(load_users); for (auto &load_user : sorted_load_users) { - if (!IsDependOn(load_user, update_state) && load_user != update_state) { + if (!IsDependOn(load_user, update_state) && !IsPrimitiveCNode(load_user, prim::kPrimUpdateState)) { processed_nodes_.insert(load_user); if (!IsInUpdateState(load_user, update_state)) { manager_->AddEdge(update_state, load_user);