diff --git a/lite/api/cxx_api.cc b/lite/api/cxx_api.cc index 12ddcf39808413b6a7bf07a98b3047b2c2b90961..581c620b01c3b471560015f38606346db963e219 100644 --- a/lite/api/cxx_api.cc +++ b/lite/api/cxx_api.cc @@ -152,7 +152,7 @@ std::vector Predictor::GetOutputNames() { return output_names_; } // get param names std::vector Predictor::GetParamNames() { - return exec_scope_->VarNames(); + return exec_scope_->AttributeVarNames(); } // append the names of inputs and outputs into input_names_ and output_names_ diff --git a/lite/core/scope.cc b/lite/core/scope.cc index 1bb3388298f060cd6d7949bc337c5825bc6b809a..e299b7e1e5a7ab48167f5d32bed97e409d02025f 100644 --- a/lite/core/scope.cc +++ b/lite/core/scope.cc @@ -60,14 +60,12 @@ Variable *Scope::FindLocalVar(const std::string &name) const { return nullptr; } -std::vector Scope::VarNames() const { +std::vector Scope::AttributeVarNames() const { std::vector resulted_keys; - auto keys = LocalVarNames(); - resulted_keys.insert(resulted_keys.end(), keys.begin(), keys.end()); const Scope *cur_scope = this; while (cur_scope->parent()) { cur_scope = cur_scope->parent(); - keys = cur_scope->LocalVarNames(); + auto keys = cur_scope->LocalVarNames(); resulted_keys.insert(resulted_keys.end(), keys.begin(), keys.end()); } return resulted_keys; diff --git a/lite/core/scope.h b/lite/core/scope.h index f4243070737d3262f6564e8e29c2220347713f92..aa3a8a1bfb7f4bf1cc00b548c0b0962ce8d73663 100644 --- a/lite/core/scope.h +++ b/lite/core/scope.h @@ -45,8 +45,8 @@ class Scope final { const Scope* parent() const { return parent_; } - // Get all params in each scope. - std::vector VarNames() const; + // Get attribute params stored in parent scopes. + std::vector AttributeVarNames() const; // Following the legacy scope interface. std::vector LocalVarNames() const;