diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 7d5a6198a03c002e182617204686a37b3d7c6db1..8c83748668e9f91e9c333beb8494c3ef1db875dc 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -812,6 +812,8 @@ void OperatorWithKernel::RunImpl(const Scope& scope, RuntimeInferShapeContext infer_shape_ctx(*this, exec_scope, ctx); this->InferShape(&infer_shape_ctx); + // TODO(panyx0718): ExecutionContext should only depend on RuntimeContext + // not Scope. Imperative mode only pass inputs and get outputs. kernel_iter->second(ExecutionContext(*this, exec_scope, *dev_ctx, ctx)); if (!transfered_inplace_vars.empty()) { @@ -919,13 +921,6 @@ Scope* OperatorWithKernel::PrepareData( SetTensorToVariable(*var, out, trans_var); } } - for (auto& var_name_item : Outputs()) { - std::vector& output_vars = ctx->outputs[var_name_item.first]; - for (size_t i = 0; i < var_name_item.second.size(); ++i) { - auto& var_name = var_name_item.second[i]; - output_vars[i] = scope.FindVar(var_name); - } - } return new_scope; }