提交 ed4e3db8 编写于 作者: D DannyIsFunny

test=develop

上级 b42cd1d4
...@@ -152,7 +152,7 @@ std::vector<std::string> Predictor::GetOutputNames() { return output_names_; } ...@@ -152,7 +152,7 @@ std::vector<std::string> Predictor::GetOutputNames() { return output_names_; }
// get param names // get param names
std::vector<std::string> Predictor::GetParamNames() { std::vector<std::string> Predictor::GetParamNames() {
return exec_scope_->VarNames(); return exec_scope_->AttributeVarNames();
} }
// append the names of inputs and outputs into input_names_ and output_names_ // append the names of inputs and outputs into input_names_ and output_names_
......
...@@ -60,14 +60,12 @@ Variable *Scope::FindLocalVar(const std::string &name) const { ...@@ -60,14 +60,12 @@ Variable *Scope::FindLocalVar(const std::string &name) const {
return nullptr; return nullptr;
} }
std::vector<std::string> Scope::VarNames() const { std::vector<std::string> Scope::AttributeVarNames() const {
std::vector<std::string> resulted_keys; std::vector<std::string> resulted_keys;
auto keys = LocalVarNames();
resulted_keys.insert(resulted_keys.end(), keys.begin(), keys.end());
const Scope *cur_scope = this; const Scope *cur_scope = this;
while (cur_scope->parent()) { while (cur_scope->parent()) {
cur_scope = 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()); resulted_keys.insert(resulted_keys.end(), keys.begin(), keys.end());
} }
return resulted_keys; return resulted_keys;
......
...@@ -45,8 +45,8 @@ class Scope final { ...@@ -45,8 +45,8 @@ class Scope final {
const Scope* parent() const { return parent_; } const Scope* parent() const { return parent_; }
// Get all params in each scope. // Get attribute params stored in parent scopes.
std::vector<std::string> VarNames() const; std::vector<std::string> AttributeVarNames() const;
// Following the legacy scope interface. // Following the legacy scope interface.
std::vector<std::string> LocalVarNames() const; std::vector<std::string> LocalVarNames() const;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册