From 6e964ad5cbce4c0c9a4f2365aaac0905e6ecf71a Mon Sep 17 00:00:00 2001 From: wanghaoshuang Date: Thu, 7 Sep 2017 07:34:30 +0800 Subject: [PATCH] Fix issues --- paddle/operators/clip_op.cc | 4 ++-- paddle/operators/clip_op.cu | 4 ++-- paddle/operators/clip_op.h | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/operators/clip_op.cc b/paddle/operators/clip_op.cc index 8eea84388..65bb0ba01 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 51941deec..7073fcb02 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 b9a2c61f7..d596504bd 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"); -- GitLab