From cc0ae1f1a17adc687499e0ee03f40374722869d5 Mon Sep 17 00:00:00 2001 From: luotao1 Date: Mon, 18 Mar 2019 13:00:23 +0800 Subject: [PATCH] refine with comments test=develop --- .../fluid/framework/ir/runtime_context_cache_pass.cc | 2 +- paddle/fluid/framework/operator.cc | 2 +- paddle/fluid/framework/operator.h | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/ir/runtime_context_cache_pass.cc b/paddle/fluid/framework/ir/runtime_context_cache_pass.cc index 75f3795185b..67b29512c4c 100644 --- a/paddle/fluid/framework/ir/runtime_context_cache_pass.cc +++ b/paddle/fluid/framework/ir/runtime_context_cache_pass.cc @@ -25,7 +25,7 @@ std::unique_ptr RuntimeContextCachePass::ApplyImpl( VLOG(3) << "Applies Runtime Context Cache strategy."; for (const Node* n : graph->Nodes()) { if (n->IsOp()) { - n->Op()->SetAttr(kEnableRuntimeContext, true); + n->Op()->SetAttr(kEnableCacheRuntimeContext, true); } } return graph; diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index ac1ad2b05e1..ab96201b339 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -876,7 +876,7 @@ std::vector* OperatorWithKernel::GetKernelConfig( RuntimeContext* OperatorWithKernel::GetRuntimeContext( const Scope& scope) const { - if (!HasAttr(kEnableRuntimeContext)) { + if (!HasAttr(kEnableCacheRuntimeContext)) { return new RuntimeContext(Inputs(), Outputs(), scope); } else { const Scope* cur_scope = &scope; diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index f0592f4f5fc..ca5f0e27b36 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -63,12 +63,12 @@ constexpr char kZeroVarSuffix[] = "@ZERO"; constexpr char kNewGradSuffix[] = "@NEWGRAD@"; /// RuntimeContext is used to relate input/output names of Operator with -/// the corresponding variables in Scope. -/// If an Op has attribute kEnableRuntimeContext, it means that in a same Scope, -/// since the input/output names of this Op do not change in the execution, -/// RuntimeContext could be created only at the first iteration of this Op's -/// execution to save the elapsed time. -constexpr char kEnableRuntimeContext[] = "@ENABLE_RUNTIME_CONTEXT@"; +/// the corresponding variables in name scope. +/// If an Op has attribute kEnableCacheRuntimeContext, it means that in a same +/// name scope, since the input/output names of this Op do not change in the +/// execution, RuntimeContext could be created only at the first iteration of +/// this Op's execution to save the elapsed time. +constexpr char kEnableCacheRuntimeContext[] = "@ENABLE_CACHE_RUNTIME_CONTEXT@"; /// If an Op has this attribute, all its kernels should calculate output /// variable's shape in the corresponding Compute() function. And -- GitLab