Browse Source

!1975 Optimized IsTrivial function

Merge pull request !1975 from Kang/master
tags/v0.5.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
fe503d6571
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      mindspore/ccsrc/optimizer/irpass/inline.h

+ 1
- 5
mindspore/ccsrc/optimizer/irpass/inline.h View File

@@ -71,11 +71,7 @@ class ReplaceApplicator : public AnfVisitor {
using CriterionFuncType = std::function<bool(FuncGraphPtr, AnfNodePtr)>;

bool IsTrivial(const FuncGraphPtr &fg, AnfNodePtr) {
auto &s = fg->nodes();
int n_cnode = std::count_if(s.begin(), s.end(), [](const AnfNodePtr &n) {
MS_EXCEPTION_IF_NULL(n);
return n->isa<CNode>();
});
auto n_cnode = fg->nodes().size() - fg->parameters().size();
// There is at least one CNode(return, other_node).
return n_cnode <= 2;
}


Loading…
Cancel
Save