diff --git a/paddle/fluid/framework/grad_op_desc_maker.h b/paddle/fluid/framework/grad_op_desc_maker.h index 46ebf4051fbd4ad1bbd6182691aee930eb360d84..3645cd4e432a8975e76d7120038c83be4745dfe0 100644 --- a/paddle/fluid/framework/grad_op_desc_maker.h +++ b/paddle/fluid/framework/grad_op_desc_maker.h @@ -55,14 +55,11 @@ class GradOpDescMakerBase { std::back_inserter(ret_val), [this](const std::string& fwd_var_name) -> std::string { auto g_name = GradVarName(fwd_var_name); - if (no_grad_set_.empty()) { + if (no_grad_set_.empty() || !no_grad_set_.count(g_name)) { (*this->grad_to_var_)[g_name] = fwd_var_name; return g_name; - } else if (no_grad_set_.count(g_name)) { - return kEmptyVarName; } else { - (*this->grad_to_var_)[g_name] = fwd_var_name; - return g_name; + return kEmptyVarName; } }); if (!drop_empty_grad) { diff --git a/paddle/fluid/imperative/profiler.cc b/paddle/fluid/imperative/profiler.cc index 828c36c5aef5d3331fc2fd0697de9121473ede2e..34570b3a60ec83fdeb1577789271942125b16eb1 100644 --- a/paddle/fluid/imperative/profiler.cc +++ b/paddle/fluid/imperative/profiler.cc @@ -36,13 +36,11 @@ static bool gTracerProfilerStarted = false; #endif void StartProfile() { - LOG(ERROR) << "XX " << FLAGS_tracer_profile_fname; if (!FLAGS_tracer_profile_fname.empty()) { std::call_once(gTracerProfileOnce, [] { #ifdef WITH_GPERFTOOLS ProfilerStart(FLAGS_tracer_profile_fname.c_str()); gTracerProfilerStarted = true; - LOG(ERROR) << "YY"; #else LOG(WARNING) << "Paddle is not compiled with gperftools. " "FLAGS_tracer_profile_fname will be ignored"; @@ -52,7 +50,6 @@ void StartProfile() { } void StopProfile() { - LOG(ERROR) << "ZZ " << FLAGS_tracer_profile_fname; #ifdef WITH_GPERFTOOLS ProfilerFlush(); #else