提交 c0ddb93c 编写于 作者: M minqiyang

Polish code

test=develop
上级 f8373949
...@@ -55,14 +55,11 @@ class GradOpDescMakerBase { ...@@ -55,14 +55,11 @@ class GradOpDescMakerBase {
std::back_inserter(ret_val), std::back_inserter(ret_val),
[this](const std::string& fwd_var_name) -> std::string { [this](const std::string& fwd_var_name) -> std::string {
auto g_name = GradVarName(fwd_var_name); 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; (*this->grad_to_var_)[g_name] = fwd_var_name;
return g_name; return g_name;
} else if (no_grad_set_.count(g_name)) {
return kEmptyVarName;
} else { } else {
(*this->grad_to_var_)[g_name] = fwd_var_name; return kEmptyVarName;
return g_name;
} }
}); });
if (!drop_empty_grad) { if (!drop_empty_grad) {
......
...@@ -36,13 +36,11 @@ static bool gTracerProfilerStarted = false; ...@@ -36,13 +36,11 @@ static bool gTracerProfilerStarted = false;
#endif #endif
void StartProfile() { void StartProfile() {
LOG(ERROR) << "XX " << FLAGS_tracer_profile_fname;
if (!FLAGS_tracer_profile_fname.empty()) { if (!FLAGS_tracer_profile_fname.empty()) {
std::call_once(gTracerProfileOnce, [] { std::call_once(gTracerProfileOnce, [] {
#ifdef WITH_GPERFTOOLS #ifdef WITH_GPERFTOOLS
ProfilerStart(FLAGS_tracer_profile_fname.c_str()); ProfilerStart(FLAGS_tracer_profile_fname.c_str());
gTracerProfilerStarted = true; gTracerProfilerStarted = true;
LOG(ERROR) << "YY";
#else #else
LOG(WARNING) << "Paddle is not compiled with gperftools. " LOG(WARNING) << "Paddle is not compiled with gperftools. "
"FLAGS_tracer_profile_fname will be ignored"; "FLAGS_tracer_profile_fname will be ignored";
...@@ -52,7 +50,6 @@ void StartProfile() { ...@@ -52,7 +50,6 @@ void StartProfile() {
} }
void StopProfile() { void StopProfile() {
LOG(ERROR) << "ZZ " << FLAGS_tracer_profile_fname;
#ifdef WITH_GPERFTOOLS #ifdef WITH_GPERFTOOLS
ProfilerFlush(); ProfilerFlush();
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册