solve problem when create parameter from 'call' cnode

This commit is contained in:
chenfei 2020-04-15 15:24:16 +08:00
parent 9c9c709159
commit 734fabb780
2 changed files with 6 additions and 2 deletions

View File

@ -822,7 +822,7 @@ GraphId AscendSession::GetGraphIdByNode(const AnfNodePtr &front_anf) const {
} }
} }
MS_EXCEPTION_IF_NULL(front_anf); MS_EXCEPTION_IF_NULL(front_anf);
MS_LOG(WARNING) << "front_anf " << front_anf->DebugString() << " is not exist in any graph"; MS_LOG(DEBUG) << "front_anf " << front_anf->DebugString() << " is not exist in any graph";
return kInvalidGraphId; return kInvalidGraphId;
} }

View File

@ -264,7 +264,11 @@ std::vector<AnfNodePtr> CreateParameterFromTuple(const AnfNodePtr &node, bool va
MS_EXCEPTION_IF_NULL(node); MS_EXCEPTION_IF_NULL(node);
MS_EXCEPTION_IF_NULL(graph); MS_EXCEPTION_IF_NULL(graph);
std::vector<AnfNodePtr> parameters; std::vector<AnfNodePtr> parameters;
std::vector<AnfNodePtr> pre_graph_out = AnfAlgo::GetAllOutput(node, {prim::kPrimTupleGetItem}); std::vector<AnfNodePtr> pre_graph_out = {node};
// If a cnode is a call, it's input0 is a cnode too, so it doesn't have primitive
if (!AnfAlgo::IsRealKernel(node)) {
pre_graph_out = AnfAlgo::GetAllOutput(node, {prim::kPrimTupleGetItem});
}
auto valid_inputs = graph->MutableValidInputs(); auto valid_inputs = graph->MutableValidInputs();
MS_EXCEPTION_IF_NULL(valid_inputs); MS_EXCEPTION_IF_NULL(valid_inputs);
auto graph_inputs = graph->MutableInputs(); auto graph_inputs = graph->MutableInputs();