From 016445c4bf1fc156cb71b052d3222f7db9532f6a Mon Sep 17 00:00:00 2001 From: Yan Chunwei Date: Wed, 12 Jun 2019 21:12:25 +0800 Subject: [PATCH] fix compile (#18039) test=develop --- paddle/fluid/lite/api/light_api.h | 9 ++++----- paddle/fluid/lite/kernels/x86/sgd_compute.cc | 14 +++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/paddle/fluid/lite/api/light_api.h b/paddle/fluid/lite/api/light_api.h index 474e5da78..a43755c87 100644 --- a/paddle/fluid/lite/api/light_api.h +++ b/paddle/fluid/lite/api/light_api.h @@ -72,9 +72,8 @@ class LightPredictor { // Create the kernels of the target places, and filter out the specific // kernel with the target alias. - for (auto& op : program.ops_) { - lite::pb::OpDesc desc(op->op_info()->desc()); - auto kernel_type = desc.GetAttr(kKernelTypeAttr).get(); + for (auto& op : program.ops()) { + auto kernel_type = op->op_info()->GetAttr(kKernelTypeAttr); std::string op_type, alias; Place place; KernelBase::ParseKernelType(kernel_type, &op_type, &alias, &place); @@ -89,8 +88,8 @@ class LightPredictor { insts.emplace_back(op, std::move(*it)); } program_.reset(new RuntimeProgram(std::move(insts))); - CHECK(program.exec_scope_); - program_->set_exec_scope(program.exec_scope_); + CHECK(program.exec_scope()); + program_->set_exec_scope(program.exec_scope()); } private: diff --git a/paddle/fluid/lite/kernels/x86/sgd_compute.cc b/paddle/fluid/lite/kernels/x86/sgd_compute.cc index 27261fd14..2b50c9172 100644 --- a/paddle/fluid/lite/kernels/x86/sgd_compute.cc +++ b/paddle/fluid/lite/kernels/x86/sgd_compute.cc @@ -29,9 +29,9 @@ class SGDCompute : public KernelLite { using param_t = operators::ActivationParam; void Run() override { - auto &context = context_->As(); + auto &context = ctx_->As(); auto &sgd_param = *param_.get_mutable(); - CHECK(context.x86_device_context); + CHECK(context.x86_device_context()); // param.Out->template mutable_data(); @@ -45,12 +45,12 @@ class SGDCompute : public KernelLite { PADDLE_ENFORCE_EQ(grad->numel(), sz); paddle::operators::jit::sgd_attr_t attr(1, sz, 1, sz, 1); - const T *lr = learning_rate->data(); - const T *param_data = param->data(); - const T *grad_data = grad->data(); + const T *lr = learning_rate->template data(); + const T *param_data = param->template data(); + const T *grad_data = grad->template data(); int64_t rows_idx = 0; - T *out_data = - param_out->mutable_data(context.x86_device_context->GetPlace()); + T *out_data = param_out->template mutable_data( + context.x86_device_context()->GetPlace()); auto sgd = paddle::operators::jit::KernelFuncs, -- GitLab