提交 cc0ae1f1 编写于 作者: L luotao1

refine with comments

test=develop
上级 a275fd6e
...@@ -25,7 +25,7 @@ std::unique_ptr<ir::Graph> RuntimeContextCachePass::ApplyImpl( ...@@ -25,7 +25,7 @@ std::unique_ptr<ir::Graph> RuntimeContextCachePass::ApplyImpl(
VLOG(3) << "Applies Runtime Context Cache strategy."; VLOG(3) << "Applies Runtime Context Cache strategy.";
for (const Node* n : graph->Nodes()) { for (const Node* n : graph->Nodes()) {
if (n->IsOp()) { if (n->IsOp()) {
n->Op()->SetAttr(kEnableRuntimeContext, true); n->Op()->SetAttr(kEnableCacheRuntimeContext, true);
} }
} }
return graph; return graph;
......
...@@ -876,7 +876,7 @@ std::vector<KernelConfig>* OperatorWithKernel::GetKernelConfig( ...@@ -876,7 +876,7 @@ std::vector<KernelConfig>* OperatorWithKernel::GetKernelConfig(
RuntimeContext* OperatorWithKernel::GetRuntimeContext( RuntimeContext* OperatorWithKernel::GetRuntimeContext(
const Scope& scope) const { const Scope& scope) const {
if (!HasAttr(kEnableRuntimeContext)) { if (!HasAttr(kEnableCacheRuntimeContext)) {
return new RuntimeContext(Inputs(), Outputs(), scope); return new RuntimeContext(Inputs(), Outputs(), scope);
} else { } else {
const Scope* cur_scope = &scope; const Scope* cur_scope = &scope;
......
...@@ -63,12 +63,12 @@ constexpr char kZeroVarSuffix[] = "@ZERO"; ...@@ -63,12 +63,12 @@ constexpr char kZeroVarSuffix[] = "@ZERO";
constexpr char kNewGradSuffix[] = "@NEWGRAD@"; constexpr char kNewGradSuffix[] = "@NEWGRAD@";
/// RuntimeContext is used to relate input/output names of Operator with /// RuntimeContext is used to relate input/output names of Operator with
/// the corresponding variables in Scope. /// the corresponding variables in name scope.
/// If an Op has attribute kEnableRuntimeContext, it means that in a same Scope, /// If an Op has attribute kEnableCacheRuntimeContext, it means that in a same
/// since the input/output names of this Op do not change in the execution, /// name scope, since the input/output names of this Op do not change in the
/// RuntimeContext could be created only at the first iteration of this Op's /// execution, RuntimeContext could be created only at the first iteration of
/// execution to save the elapsed time. /// this Op's execution to save the elapsed time.
constexpr char kEnableRuntimeContext[] = "@ENABLE_RUNTIME_CONTEXT@"; constexpr char kEnableCacheRuntimeContext[] = "@ENABLE_CACHE_RUNTIME_CONTEXT@";
/// If an Op has this attribute, all its kernels should calculate output /// If an Op has this attribute, all its kernels should calculate output
/// variable's shape in the corresponding Compute() function. And /// variable's shape in the corresponding Compute() function. And
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册