Browse Source

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

tags/v1.1.0
yujianfeng 5 years ago
parent
commit
dc954d4c96
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      mindspore/ccsrc/backend/optimizer/common/helper.cc

+ 8
- 0
mindspore/ccsrc/backend/optimizer/common/helper.cc View File

@@ -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