From ed4e3db8e37a189071d6c654c9b45c1de63003eb Mon Sep 17 00:00:00 2001 From: DannyIsFunny <912790387@qq.com> Date: Fri, 20 Mar 2020 06:31:25 +0000 Subject: [PATCH] test=develop --- lite/api/cxx_api.cc | 2 +- lite/core/scope.cc | 6 ++---- lite/core/scope.h | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lite/api/cxx_api.cc b/lite/api/cxx_api.cc index 12ddcf3980..581c620b01 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 1bb3388298..e299b7e1e5 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 f424307073..aa3a8a1bfb 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; -- GitLab