From f9c2a5c38e3800387aaedcc05bf0e49d0f568a65 Mon Sep 17 00:00:00 2001 From: sweetsky0901 Date: Mon, 27 Nov 2017 15:56:45 +0800 Subject: [PATCH] modify for code review zcd --- paddle/operators/unpool_op.cc | 4 ++-- paddle/operators/unpool_op.h | 4 ++-- python/paddle/v2/fluid/tests/test_unpool_op.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/operators/unpool_op.cc b/paddle/operators/unpool_op.cc index f00459cd85..addceca159 100644 --- a/paddle/operators/unpool_op.cc +++ b/paddle/operators/unpool_op.cc @@ -46,7 +46,7 @@ class Unpool2dOpMaker : public framework::OpProtoAndCheckerMaker { "(vector defalut:{0,0}), " "paddings (height, width) of unpooling operator.") .SetDefault({0, 0}); - AddAttr("unpoolingtype", + AddAttr("unpooling_type", "(string), unpooling type, can be \"max\" for max-unpooling ") .InEnum({"max"}); AddComment(R"DOC( @@ -87,7 +87,7 @@ public: auto in_x_dims = ctx->GetInputDim("X"); auto in_y_dims = ctx->GetInputDim("Y"); std::string unpooling_type = - ctx->Attrs().Get("unpoolingtype"); + ctx->Attrs().Get("unpooling_type"); std::vector ksize = ctx->Attrs().Get>("ksize"); std::vector strides = ctx->Attrs().Get>("strides"); std::vector paddings = ctx->Attrs().Get>("paddings"); diff --git a/paddle/operators/unpool_op.h b/paddle/operators/unpool_op.h index c294221181..f05d22b49f 100644 --- a/paddle/operators/unpool_op.h +++ b/paddle/operators/unpool_op.h @@ -28,7 +28,7 @@ class UnpoolKernel : public framework::OpKernel { const framework::Tensor* in_x = context.Input("X"); const framework::Tensor* in_y = context.Input("Y"); auto * out = context.Output("Out"); - std::string unpooling_type = context.Attr("unpoolingtype"); + std::string unpooling_type = context.Attr("unpooling_type"); std::vector ksize = context.Attr>("ksize"); std::vector strides = context.Attr>("strides"); std::vector paddings = context.Attr>("paddings"); @@ -53,7 +53,7 @@ class UnpoolGradKernel : public framework::OpKernel { context.Input(framework::GradVarName("Out")); framework::Tensor* in_x_grad = context.Output(framework::GradVarName("X")); - std::string unpooling_type = context.Attr("unpoolingtype"); + std::string unpooling_type = context.Attr("unpooling_type"); std::vector ksize = context.Attr>("ksize"); std::vector strides = context.Attr>("strides"); std::vector paddings = context.Attr>("paddings"); diff --git a/python/paddle/v2/fluid/tests/test_unpool_op.py b/python/paddle/v2/fluid/tests/test_unpool_op.py index 3fdee9091f..22826dc1b3 100644 --- a/python/paddle/v2/fluid/tests/test_unpool_op.py +++ b/python/paddle/v2/fluid/tests/test_unpool_op.py @@ -58,7 +58,7 @@ class TestUnpoolOp(OpTest): 'strides': self.strides, 'paddings': self.paddings, 'ksize': self.ksize, - 'unpoolingtype': self.unpoolingtype, + 'unpooling_type': self.unpooling_type, } self.outputs = {'Out': output.astype('float32')} @@ -70,7 +70,7 @@ class TestUnpoolOp(OpTest): def init_test_case(self): self.Unpool2d_forward_naive = unpool2dmax_forward_naive - self.unpoolingtype = "max" + self.unpooling_type = "max" self.shape = [6, 4, 5, 5] self.ksize = [3, 3] self.strides = [2, 2] -- GitLab