From 74605a9f226ea2426cb6217207e39b5cc8e51ca2 Mon Sep 17 00:00:00 2001 From: chenfei Date: Thu, 4 Mar 2021 20:04:21 +0800 Subject: [PATCH] return if is_once_ is true --- mindspore/ccsrc/frontend/optimizer/opt.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mindspore/ccsrc/frontend/optimizer/opt.cc b/mindspore/ccsrc/frontend/optimizer/opt.cc index e9c557a4d2..03b42ab474 100644 --- a/mindspore/ccsrc/frontend/optimizer/opt.cc +++ b/mindspore/ccsrc/frontend/optimizer/opt.cc @@ -184,6 +184,9 @@ bool SubstitutionList::ApplyIRToSubstitutions(const OptimizerPtr &optimizer, con for (auto &substitution : list_) { auto res = DoTransform(optimizer, node, substitution); if (res != nullptr) { + if (is_once_) { + return true; + } change = true; changes = true; node = res; @@ -229,6 +232,9 @@ bool SubstitutionList::ApplySubstitutionToIR(const OptimizerPtr &optimizer, cons changes = true; node = res; } + if (change && is_once_) { + return true; + } UpdateTransformingList(optimizer, node, &todo, change, seen); }