From 53ab7e78b164a5e1ed8e15aa29ddbcfa5445f338 Mon Sep 17 00:00:00 2001 From: yangyaming Date: Thu, 7 Sep 2017 12:18:40 +0800 Subject: [PATCH] Adapt new interface. --- paddle/operators/smooth_l1_loss_op.cc | 3 ++- paddle/operators/smooth_l1_loss_op.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/operators/smooth_l1_loss_op.cc b/paddle/operators/smooth_l1_loss_op.cc index e9a3847417..d2c6d955a7 100644 --- a/paddle/operators/smooth_l1_loss_op.cc +++ b/paddle/operators/smooth_l1_loss_op.cc @@ -111,7 +111,8 @@ class SmoothL1LossGradOp : public framework::OperatorWithKernel { namespace ops = paddle::operators; REGISTER_OP(smooth_l1_loss, ops::SmoothL1LossOp, - ops::SmoothL1LossOpMaker, ops::SmoothL1LossGradOp); + ops::SmoothL1LossOpMaker, smooth_l1_loss_grad, + ops::SmoothL1LossGradOp); REGISTER_OP_CPU_KERNEL( smooth_l1_loss, ops::SmoothL1LossKernel); REGISTER_OP_CPU_KERNEL( diff --git a/paddle/operators/smooth_l1_loss_op.h b/paddle/operators/smooth_l1_loss_op.h index bb823a56a3..218fb4c5a5 100644 --- a/paddle/operators/smooth_l1_loss_op.h +++ b/paddle/operators/smooth_l1_loss_op.h @@ -59,7 +59,7 @@ class SmoothL1LossKernel : public framework::OpKernel { out1->mutable_data(context.GetPlace()); auto place = context.GetEigenDevice(); - auto sigma = static_cast(context.op_.GetAttr("sigma")); + auto sigma = static_cast(context.op().Attr("sigma")); T sigma2 = sigma * sigma; bool has_weight = (in2 != nullptr) && (in3 != nullptr); @@ -122,7 +122,7 @@ class SmoothL1LossGradKernel : public framework::OpKernel { auto* in1 = context.Input("OutsideWeight"); auto* in2 = context.Input("diff"); auto* og = context.Input(framework::GradVarName("Out")); - auto sigma = static_cast(context.op_.GetAttr("sigma")); + auto sigma = static_cast(context.op().Attr("sigma")); T sigma2 = sigma * sigma; bool has_weight = (in0 != nullptr) && (in1 != nullptr); -- GitLab