提交 cc0ae1f1 编写于 作者: L luotao1

refine with comments

test=develop
上级 a275fd6e
......@@ -25,7 +25,7 @@ std::unique_ptr<ir::Graph> 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;
......
......@@ -876,7 +876,7 @@ std::vector<KernelConfig>* 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;
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册