Fix checking nop for a cnode whose first input is not a value node

pull/7306/head
yujianfeng 4 years ago
parent 83bdc34716
commit dc954d4c96

@ -405,6 +405,14 @@ bool IsNopNode(const AnfNodePtr &node) {
}
CNodePtr cnode = node->cast<CNodePtr>();
MS_EXCEPTION_IF_NULL(cnode);
if (cnode->inputs().empty()) {
return false;
}
auto input0 = cnode->input(0);
MS_EXCEPTION_IF_NULL(input0);
if (!input0->isa<ValueNode>()) {
return false;
}
bool is_nop_node = false;
if (AnfAlgo::HasNodeAttr("nop_op", cnode)) {
is_nop_node = AnfAlgo::GetNodeAttr<bool>(cnode, "nop_op");

Loading…
Cancel
Save