diff --git a/paddle/fluid/lite/api/light_api.h b/paddle/fluid/lite/api/light_api.h index 474e5da78bd2cd201b17f9a223bd1a177861a532..a43755c87387e6af4d65f541cf1ba61828f3d2a5 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 27261fd14d643f82c8847887c6788f4bb6820439..2b50c9172a0bcbea5c4fb269c295ee37ee99ab05 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,