From 5babcd02dd57280f11949eae4edd9f380878c6ba Mon Sep 17 00:00:00 2001 From: Tao Luo Date: Thu, 16 May 2019 13:29:06 +0800 Subject: [PATCH] Revert "remove unnecessary prepare_data (#17080)" (#17432) This reverts commit aca60e9a20706125ac43aaa7ff23a3ac007e65f8. --- paddle/fluid/framework/operator.cc | 5 ----- paddle/fluid/framework/operator.h | 1 - 2 files changed, 6 deletions(-) diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index fae33f55b05..7756fe4f8f2 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -1023,7 +1023,6 @@ Scope* OperatorWithKernel::PrepareData( std::vector* transfered_inplace_vars, RuntimeContext* ctx) const { Scope* new_scope = nullptr; - if (!need_prepare_data_) return new_scope; std::unordered_set no_buffer_ins; if (info_) { @@ -1116,10 +1115,6 @@ Scope* OperatorWithKernel::PrepareData( SetTensorToVariable(*var, out, trans_var); } } - // If new_scope = nullptr, it means that for each input of this Op, there is - // no TransformData. Thus, PrepareData could be skipped at the rest iterations - // of this Op's execution to save the elapsed time. - if (!new_scope) need_prepare_data_ = false; return new_scope; } diff --git a/paddle/fluid/framework/operator.h b/paddle/fluid/framework/operator.h index 4bc94b4c5cd..3332530b3c0 100644 --- a/paddle/fluid/framework/operator.h +++ b/paddle/fluid/framework/operator.h @@ -507,7 +507,6 @@ class OperatorWithKernel : public OperatorBase { mutable std::unique_ptr kernel_func_; mutable std::unique_ptr runtime_ctx_; mutable const Scope* pre_scope_ = nullptr; - mutable bool need_prepare_data_ = true; mutable bool enable_cache_runtime_context = false; mutable bool enable_cache_expected_kernel = false; mutable bool all_kernels_must_compute_runtime_shape = false; -- GitLab