diff --git a/paddle/operators/deconv2d_op.cc b/paddle/operators/deconv2d_op.cc index 331fbd59825ec2c65f5cacb6323af53377300a8f..8481aefdc1a9ea53b212c10af33cd0bfd2287125 100644 --- a/paddle/operators/deconv2d_op.cc +++ b/paddle/operators/deconv2d_op.cc @@ -31,12 +31,14 @@ void Deconv2DOp::InferShape(framework::InferShapeContext* ctx) const { std::vector strides = ctx->Attrs().Get>("strides"); std::vector paddings = ctx->Attrs().Get>("paddings"); - for (int i = 0; i < paddings.size(); ++i) { + for (size_t i = 0; i < paddings.size(); ++i) { PADDLE_ENFORCE_EQ(paddings[i], 0, "No Padding allowed in deconv op."); } - PADDLE_ENFORCE_EQ(in_dims.size(), 4, "Deconv2DOp input should be 4-D."); - PADDLE_ENFORCE_EQ(filter_dims.size(), 4, "Deconv2DOp filter should be 4-D."); + PADDLE_ENFORCE_EQ(in_dims.size(), 4, + "Deconv2DOp input should be 4-D tensor."); + PADDLE_ENFORCE_EQ(filter_dims.size(), 4, + "Deconv2DOp filter should be 4-D tensor."); PADDLE_ENFORCE_EQ(in_dims[1], filter_dims[0], "input and kernel input dimension should be equal."); @@ -52,14 +54,14 @@ Deconv2DOpMaker::Deconv2DOpMaker(framework::OpProto* proto, AddInput( "Input", "The input tensor of deconvolution operator. " - "The format of input tensor is NMHW. Where N is batch size, M is the " + "The format of input tensor is NCHW. Where N is batch size, C is the " "number of input channels, H and W is the height and width of image."); AddInput("Filter", "The filter tensor of deconvolution operator." - "The format of the filter tensor is MCHW, where M is the number of " - "input image channels, C is the number of output image channels, " + "The format of the filter tensor is MCHW, where C is the number of " + "output image channels, M is the number of input image channels, " "H and W is height and width of filter. " - "We enforce groups number == 1 and padding == 0 in our " + "We enforce groups number == 1 and padding == 0 in " "deconvolution Scenario."); AddOutput("Output", "The output tensor of deconvolution operator." diff --git a/paddle/operators/deconv2d_op.h b/paddle/operators/deconv2d_op.h index 71254c9524f119d82d02dc0783d1c4fe9f756a3d..973190efab442ebc7b1bf3449c4d3fb11622020c 100644 --- a/paddle/operators/deconv2d_op.h +++ b/paddle/operators/deconv2d_op.h @@ -55,7 +55,7 @@ class GemmDeconv2DKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext& context) const override { const Tensor* input = context.Input("Input"); - // filter will be reshaped, so we do not use constant pointer here + // The filter will be reshaped, so it should not be constant pointer Tensor filter = *context.Input("Filter"); Tensor* output = context.Output("Output"); @@ -132,8 +132,8 @@ class GemmDeconvGrad2DKernel : public framework::OpKernel { const Tensor* output_grad = context.Input(framework::GradVarName("Output")); - // For filter, we do not use const pointer b/c we will do reshape - // but we should avoid modifying its value + // For filter, we do not use const pointer b/c we will do reshape, + // but we should avoid modifying its value. Tensor filter = *context.Input("Filter"); Tensor* input_grad = @@ -142,7 +142,7 @@ class GemmDeconvGrad2DKernel : public framework::OpKernel { context.Output(framework::GradVarName("Filter")); std::vector strides = context.Attr>("strides"); - // Actually, no paddings and groups allowed in deconv + // Actually, no paddings and groups allowed in deconv. std::vector paddings = context.Attr>("paddings"); int N = input->dims()[0];