From 3ca700a98792baf04420e66d1d8e64e00981e499 Mon Sep 17 00:00:00 2001 From: Zeng Jinle <32832641+sneaxiy@users.noreply.github.com> Date: Thu, 23 Apr 2020 09:58:20 +0800 Subject: [PATCH] code clean, test=develop (#24060) --- paddle/fluid/imperative/prepared_operator.cc | 24 ++++---------------- paddle/fluid/imperative/prepared_operator.h | 12 ---------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/paddle/fluid/imperative/prepared_operator.cc b/paddle/fluid/imperative/prepared_operator.cc index 4d283d142b1..def5c860449 100644 --- a/paddle/fluid/imperative/prepared_operator.cc +++ b/paddle/fluid/imperative/prepared_operator.cc @@ -32,10 +32,10 @@ const framework::Tensor* GetTensorFromVar(const framework::Variable& var) { } template -static void PrepareDataImpl( - const platform::Place& place, const NameVarMap& ins, - const framework::OperatorWithKernel& op, - const framework::OpKernelType& expected_kernel_key) { +static void PrepareData(const platform::Place& place, + const NameVarMap& ins, + const framework::OperatorWithKernel& op, + const framework::OpKernelType& expected_kernel_key) { for (const auto& name_pair : ins) { for (const auto& var_base : name_pair.second) { const auto* tensor = GetTensorFromVar(var_base->Var()); @@ -63,20 +63,6 @@ static void PrepareDataImpl( } } -void PreparedOp::PrepareData( - const platform::Place& place, const NameVarMap& ins, - const framework::OperatorWithKernel& op, - const framework::OpKernelType& expected_kernel_key) { - PrepareDataImpl(place, ins, op, expected_kernel_key); -} - -void PreparedOp::PrepareData( - const platform::Place& place, const NameVarMap& ins, - const framework::OperatorWithKernel& op, - const framework::OpKernelType& expected_kernel_key) { - PrepareDataImpl(place, ins, op, expected_kernel_key); -} - PreparedOp::PreparedOp(const framework::OperatorBase& op, const framework::RuntimeContext& ctx, const framework::OperatorWithKernel::OpKernelFunc& func, @@ -122,7 +108,7 @@ PreparedOp PrepareOpImpl(const NameVarMap& ins, place = dev_ctx->GetPlace(); } - PrepareDataImpl(place, ins, op, expected_kernel_key); + PrepareData(place, ins, op, expected_kernel_key); return PreparedOp(op, ctx, kernel_iter->second, dev_ctx); } diff --git a/paddle/fluid/imperative/prepared_operator.h b/paddle/fluid/imperative/prepared_operator.h index 8ffc3eaf82f..bf02eebdbb6 100644 --- a/paddle/fluid/imperative/prepared_operator.h +++ b/paddle/fluid/imperative/prepared_operator.h @@ -47,8 +47,6 @@ class PreparedOp { const platform::Place& place, const framework::AttributeMap& attrs); - inline platform::DeviceContext* GetDeviceContext() const { return dev_ctx_; } - void Run(const NameVarMap& in, const NameVarMap& out, const framework::AttributeMap& attrs); @@ -56,16 +54,6 @@ class PreparedOp { const NameVarMap& outs, const framework::AttributeMap& attrs); - static void PrepareData(const platform::Place& place, - const NameVarMap& ins, - const framework::OperatorWithKernel& op, - const framework::OpKernelType& expected_kernel_key); - - static void PrepareData(const platform::Place& place, - const NameVarMap& ins, - const framework::OperatorWithKernel& op, - const framework::OpKernelType& expected_kernel_key); - private: const framework::OperatorBase& op_; const framework::RuntimeContext& ctx_; -- GitLab