diff --git a/paddle/framework/scope.cc b/paddle/framework/scope.cc index 5c197cec2a0054722e1c84f8a6920cb5d4f32725..72cb744707dd6f8ccf8fa02a818af4927d662f24 100644 --- a/paddle/framework/scope.cc +++ b/paddle/framework/scope.cc @@ -42,7 +42,7 @@ Variable* Scope::GetVariable(const std::string& name) const { } } -bool Scope::HasVariable(const std::string &name) { +bool Scope::HasVariable(const std::string& name) { return (vars_.count(name) > 0 || (parent_ && parent_->HasVariable(name))); } diff --git a/paddle/framework/scope.h b/paddle/framework/scope.h index 81491f34d8cb22b408c572fc0dba60ad90c008d3..a624fe3bbef3ae3c7671e6f549c2cb7c63def15f 100644 --- a/paddle/framework/scope.h +++ b/paddle/framework/scope.h @@ -14,9 +14,9 @@ limitations under the License. */ #pragma once +#include #include #include -#include #include "paddle/framework/variable.h" @@ -49,7 +49,7 @@ class Scope { Variable* GetVarLocally(const std::string& name) const; // Find if there is a Variable in this scope and it's parent scope - bool HasVariable(const std::string &name); + bool HasVariable(const std::string& name); private: std::unordered_map> vars_;