diff --git a/paddle/operators/unpool_op.cc b/paddle/operators/unpool_op.cc index f00459cd8590886cb8ff13a3bdd3c6298c65fc70..addceca1590b1ec59e8fbd3183d992bd03888109 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 c2942211816f872a0f9456a84f648b788ac6f95d..f05d22b49fe9cd32e6adca1c1f4019fec5d9bfe3 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 3fdee9091fc68e7f8953453080c3e503161b3c29..22826dc1b3561f9abd5ced628c0a1c9ccd483602 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]