diff --git a/mindspore/ccsrc/pre_activate/common/helper.cc b/mindspore/ccsrc/pre_activate/common/helper.cc index 3b7d95a6f25b00889904233d9ff5a4663d2a5fe7..3f157d6a647b15729e271c0e006e6785ff6530be 100644 --- a/mindspore/ccsrc/pre_activate/common/helper.cc +++ b/mindspore/ccsrc/pre_activate/common/helper.cc @@ -337,10 +337,6 @@ bool IsNopNode(const AnfNodePtr &node) { if (nop_nodes.find(AnfAlgo::GetCNodeName(cnode)) == nop_nodes.end()) { return false; } - if (cnode->inputs().size() != 2) { - MS_LOG(EXCEPTION) << "Nop node(" + cnode->DebugString() + ") should have only 1 input, but it has " - << cnode->inputs().size() - 1 << " inputs."; - } return true; } diff --git a/mindspore/ccsrc/session/ascend_session.cc b/mindspore/ccsrc/session/ascend_session.cc index 4455d33ee985199cb297931a97f82420b78c24cd..b0855feb490da13a83cd75cc970107a7729031c7 100755 --- a/mindspore/ccsrc/session/ascend_session.cc +++ b/mindspore/ccsrc/session/ascend_session.cc @@ -709,18 +709,17 @@ void AscendSession::SetChildGraphParameter(const AnfNodePtr &front_anf, const An << "of graph " << AnfAlgo::GetGraphId(backend_arg.get()); return; } - } - // if a parameter is a weight and not linked to any executable node,device type will be kTypeUnknown,set it's device - // type same to arg - if (AnfAlgo::GetOutputDeviceDataType(backend_parameter, 0) == kTypeUnknown) { - AnfAlgo::SetSelectKernelBuildInfo(AnfAlgo::GetSelectKernelBuildInfo(backend_arg), backend_parameter.get()); + // if a parameter is a weight and not linked to any executable node,device type will be kTypeUnknown,set it's device + // type same to arg + if (AnfAlgo::GetOutputDeviceDataType(backend_parameter, 0) == kTypeUnknown) { + AnfAlgo::SetSelectKernelBuildInfo(AnfAlgo::GetSelectKernelBuildInfo(backend_arg), backend_parameter.get()); + } + // if front anf is a parameter,we can assign the value back,because backend_parameter won't be change in it's graph + // unless it's a weight.If backend_parameter is a weight,we should assign the value back. + AnfAlgo::SetOutputAddr(AnfAlgo::GetMutableOutputAddr(backend_arg, 0), 0, backend_parameter.get()); + return; } InsertAssignToGraph(from_graph_id, backend_arg, backend_parameter); - // if front anf is a parameter,we can assign the value back,because backend_parameter won't be change in it's graph - // unless it's a weigth.If backend_parameter is a weight,we do should assign the value back - if (backend_arg->isa() && !to_graph->execution_order().empty()) { - InsertAssignToGraph(to_graph_id, backend_parameter, backend_arg); - } MS_LOG(INFO) << "Finish!"; }