!5395 fix assign memory error in pynative mode

Merge pull request !5395 from chujinjin/fix_assign_memory_error_in_pynative
pull/5395/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit 7336ed94fd

@ -339,8 +339,13 @@ void KernelRuntime::RunOpAssignOutputNodeMemory(const ValuePtr &pre_output_value
for (size_t i = 0; i < output_nodes.size(); ++i) {
auto output_node_with_index = AnfAlgo::VisitKernel(output_nodes[i], 0);
if (!output_node_with_index.first->isa<CNode>()) {
MS_LOG(EXCEPTION) << "The output node should be a cnode , but it is "
<< output_node_with_index.first->DebugString();
if (output_node_with_index.first->isa<Parameter>()) {
auto param = output_node_with_index.first->cast<ParameterPtr>();
if (!param->has_default()) {
MS_LOG(EXCEPTION) << "The output parameter should be real parameter!";
}
}
continue;
}
auto real_output_cnode = output_node_with_index.first->cast<CNodePtr>();
MS_EXCEPTION_IF_NULL(real_output_cnode);

Loading…
Cancel
Save