From 5c5f6ce72da9efe977aa3594a3fd4312d55447ae Mon Sep 17 00:00:00 2001 From: yvetteliu Date: Thu, 28 May 2020 10:40:07 +0800 Subject: [PATCH] Exeucate MS_LOG(DEBUG) outside the function. --- .../ccsrc/pipeline/static_analysis/evaluator.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/pipeline/static_analysis/evaluator.cc b/mindspore/ccsrc/pipeline/static_analysis/evaluator.cc index 542abc62058..254fd43c0b1 100644 --- a/mindspore/ccsrc/pipeline/static_analysis/evaluator.cc +++ b/mindspore/ccsrc/pipeline/static_analysis/evaluator.cc @@ -26,15 +26,17 @@ namespace mindspore { namespace abstract { namespace { -void EvalEntryLogging(const EvaluatorPtr &evaluator, const AbstractBasePtrList &arg_spec_list, - const AnfNodeConfigPtr &out_conf) { +string EvalEntryLogging(const EvaluatorPtr &evaluator, const AbstractBasePtrList &arg_spec_list, + const AnfNodeConfigPtr &out_conf) { MS_EXCEPTION_IF_NULL(evaluator); + std::stringstream ss; if (out_conf != nullptr) { - MS_LOG(DEBUG) << "Evaluator " << evaluator->ToString() << " run for " << out_conf->node()->scope()->name(); + ss << "Evaluator " << evaluator->ToString() << " run for " << out_conf->node()->scope()->name(); } for (size_t i = 0; i < arg_spec_list.size(); i++) { - MS_LOG(DEBUG) << evaluator->ToString() << " input[" << i << "] abstract value: " << arg_spec_list[i]->ToString(); + ss << evaluator->ToString() << " input[" << i << "] abstract value: " << arg_spec_list[i]->ToString(); } + return ss.str(); } void EvalFailLogging(const EvaluatorPtr &evaluator, const AbstractBasePtrList &, const AnfNodeConfigPtr &out_conf) { @@ -248,7 +250,7 @@ EvalResultPtr Evaluator::Run(AnalysisEnginePtr engine, const ConfigPtrList &args args_spec_list = NormalizeArgs(args_spec_list); args_spec_list = BroadenUndeterminedArgs(args_spec_list); trace::TraceGraphEvalEnter(shared_from_base(), out_conf); - EvalEntryLogging(shared_from_base(), args_spec_list, out_conf); + MS_LOG(DEBUG) << EvalEntryLogging(shared_from_base(), args_spec_list, out_conf); MS_EXCEPTION_IF_NULL(cache_); auto iter = cache_->find(args_spec_list); if (iter == cache_->end()) {