forked from mindspore-Ecosystem/mindspore
Fix checking nop for a cnode whose first input is not a value node
This commit is contained in:
parent
83bdc34716
commit
dc954d4c96
|
@ -405,6 +405,14 @@ bool IsNopNode(const AnfNodePtr &node) {
|
||||||
}
|
}
|
||||||
CNodePtr cnode = node->cast<CNodePtr>();
|
CNodePtr cnode = node->cast<CNodePtr>();
|
||||||
MS_EXCEPTION_IF_NULL(cnode);
|
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;
|
bool is_nop_node = false;
|
||||||
if (AnfAlgo::HasNodeAttr("nop_op", cnode)) {
|
if (AnfAlgo::HasNodeAttr("nop_op", cnode)) {
|
||||||
is_nop_node = AnfAlgo::GetNodeAttr<bool>(cnode, "nop_op");
|
is_nop_node = AnfAlgo::GetNodeAttr<bool>(cnode, "nop_op");
|
||||||
|
|
Loading…
Reference in New Issue