From d100062359579b8b7dd3b12015883987f55edb91 Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Sun, 30 Jul 2017 14:38:40 -0700 Subject: [PATCH] Update usage of Scope --- paddle/framework/operator.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/paddle/framework/operator.h b/paddle/framework/operator.h index 0a8c82ee475..a78d91f1b9d 100644 --- a/paddle/framework/operator.h +++ b/paddle/framework/operator.h @@ -119,19 +119,19 @@ class KernelContext { : op_(*op), scope_(scope), device_context_(device_context) {} const Variable* Input(int index) const { - return scope_->GetVariable(op_.inputs_[index]); + return scope_->FindVar(op_.inputs_[index]); } Variable* Output(int index) const { - return scope_->GetVariable(op_.outputs_[index]); + return scope_->FindVar(op_.outputs_[index]); } const Variable* Input(const std::string& name) const { - return scope_->GetVariable(op_.Input(name)); + return scope_->FindVar(op_.Input(name)); } const Variable* Output(const std::string& name) const { - return scope_->GetVariable(op_.Output(name)); + return scope_->FindVar(op_.Output(name)); } const std::vector Inputs(const std::string& name) const { @@ -139,7 +139,7 @@ class KernelContext { std::vector res; std::transform( names.begin(), names.end(), res.begin(), - [this](const std::string& name) { return scope_->GetVariable(name); }); + [this](const std::string& name) { return scope_->FindVar(name); }); return res; } @@ -148,7 +148,7 @@ class KernelContext { std::vector res; std::transform( names.begin(), names.end(), res.begin(), - [this](const std::string& name) { return scope_->GetVariable(name); }); + [this](const std::string& name) { return scope_->FindVar(name); }); return res; } @@ -244,7 +244,7 @@ class OperatorWithKernel : public OperatorBase { container->reserve(var_names.size()); VarToTensor convert; for (auto& name : var_names) { - auto var = scope->GetVariable(name); + auto var = scope->FindVar(name); if (var != nullptr) { container->push_back(convert(var)); } else { -- GitLab