diff --git a/paddle/operators/clip_op.cc b/paddle/operators/clip_op.cc index 8eea843889fbf19689f6baa819f2c228684bfa5b..65bb0ba0165254907c92e5a22b4e03981a2a5569 100644 --- a/paddle/operators/clip_op.cc +++ b/paddle/operators/clip_op.cc @@ -26,8 +26,8 @@ class ClipOp : public framework::OperatorWithKernel { protected: void InferShape(const framework::InferShapeContext &ctx) const override { auto x_dims = ctx.Input("X")->dims(); - auto max = GetAttr("max"); - auto min = GetAttr("min"); + auto max = Attr("max"); + auto min = Attr("min"); PADDLE_ENFORCE_LT(min, max, "max should be greater than min."); ctx.Output("Out")->Resize(x_dims); } diff --git a/paddle/operators/clip_op.cu b/paddle/operators/clip_op.cu index 51941deecec95a8096e3500c5b9c1e54db00912e..7073fcb023f9a3c4a933e4e165fd5edef5c5c8fa 100644 --- a/paddle/operators/clip_op.cu +++ b/paddle/operators/clip_op.cu @@ -34,8 +34,8 @@ template class ClipGradientOpCUDAKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& context) const override { - auto max = context.op().GetAttr("max"); - auto min = context.op().GetAttr("min"); + auto max = context.op().Attr("max"); + auto min = context.op().Attr("min"); auto* d_out = context.Input(framework::GradVarName("Out")); auto* d_x = context.Output(framework::GradVarName("X")); auto* x = context.Output("X"); diff --git a/paddle/operators/clip_op.h b/paddle/operators/clip_op.h index b9a2c61f72e988a366b2b078362c3928db7ace10..d596504bd83fda88640eb54577fdeb2c708024eb 100644 --- a/paddle/operators/clip_op.h +++ b/paddle/operators/clip_op.h @@ -30,8 +30,8 @@ template class ClipKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& context) const override { - auto max = context.op().GetAttr("max"); - auto min = context.op().GetAttr("min"); + auto max = context.op().Attr("max"); + auto min = context.op().Attr("min"); auto* x = context.Input("X"); auto* out = context.Output("Out"); out->mutable_data(context.GetPlace()); @@ -46,8 +46,8 @@ template class ClipGradKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& context) const override { - auto max = context.op().GetAttr("max"); - auto min = context.op().GetAttr("min"); + auto max = context.op().Attr("max"); + auto min = context.op().Attr("min"); auto* d_out = context.Input(framework::GradVarName("Out")); auto* d_x = context.Output(framework::GradVarName("X")); auto* x = context.Output("X");