Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 780009c

Browse files
indhubpiiswrong
authored andcommitted
Update documentation for deconvolution operation. (#6184)
* Update documentation for deconvolution operation. * Add examples. * Remove the example.
1 parent 5f625f2 commit 780009c

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

src/operator/deconvolution-inl.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,30 @@ struct DeconvolutionParam : public dmlc::Parameter<DeconvolutionParam> {
4343
bool cudnn_off;
4444
dmlc::optional<int> layout;
4545
DMLC_DECLARE_PARAMETER(DeconvolutionParam) {
46-
DMLC_DECLARE_FIELD(kernel).describe("deconvolution kernel size: (h, w) or (d, h, w)");
46+
DMLC_DECLARE_FIELD(kernel).describe("Deconvolution kernel size: (h, w) or (d, h, w). "
47+
"This is same as the kernel size used for the corresponding convolution");
4748
DMLC_DECLARE_FIELD(stride).set_default(TShape())
48-
.describe("deconvolution stride: (h, w) or (d, h, w)");
49+
.describe("The stride used for the corresponding convolution: (h, w) or (d, h, w).");
4950
DMLC_DECLARE_FIELD(dilate).set_default(TShape())
50-
.describe("deconvolution dilate: (h, w) or (d, h, w)");
51+
.describe("Dilation factor for each dimension of the input: (h, w) or (d, h, w).");
5152
DMLC_DECLARE_FIELD(pad).set_default(TShape())
52-
.describe("pad for deconvolution: (h, w) or (d, h, w). "
53-
"A good number is : (kernel-1)/2. "
54-
"If target_shape is set, "
55-
"pad will be ignored and computed accordingly");
53+
.describe("The amount of implicit zero padding added during convolution for each "
54+
"dimension of the input: "
55+
"(h, w) or (d, h, w). "
56+
"``(kernel-1)/2`` is usually a good choice. "
57+
"If `target_shape` is set, "
58+
"`pad` will be ignored and a padding that will generate the target shape "
59+
"will be used.");
5660
DMLC_DECLARE_FIELD(adj).set_default(TShape())
57-
.describe("adjustment for output shape: (h, w) or (d, h, w). "
58-
"If target_shape is set, "
59-
"ad will be ignored and computed accordingly");
61+
.describe("Adjustment for output shape: (h, w) or (d, h, w). "
62+
"If `target_shape` is set, "
63+
"`adj` will be ignored and computed accordingly.");
6064
DMLC_DECLARE_FIELD(target_shape).set_default(TShape())
61-
.describe("output shape with target shape : (h, w) or (d, h, w)");
65+
.describe("Shape of the output tensor: (h, w) or (d, h, w).");
6266
DMLC_DECLARE_FIELD(num_filter).set_range(1, 100000)
63-
.describe("deconvolution filter(channel) number");
67+
.describe("Number of output filters.");
6468
DMLC_DECLARE_FIELD(num_group).set_default(1)
65-
.describe("number of groups partition");
69+
.describe("Number of groups partition.");
6670
DMLC_DECLARE_FIELD(workspace).set_default(512).set_range(0, 8192)
6771
.describe("Maximum temporal workspace allowed for deconvolution (MB).");
6872
DMLC_DECLARE_FIELD(no_bias).set_default(true)
@@ -72,7 +76,7 @@ struct DeconvolutionParam : public dmlc::Parameter<DeconvolutionParam> {
7276
.add_enum("limited_workspace", deconv::kLimited)
7377
.add_enum("fastest", deconv::kFastest)
7478
.set_default(dmlc::optional<int>())
75-
.describe("Whether to pick convolution algo by running performance test.");
79+
.describe("Whether to pick convolution algorithm by running performance test.");
7680
DMLC_DECLARE_FIELD(cudnn_off).set_default(false)
7781
.describe("Turn off cudnn for this layer.");
7882
DMLC_DECLARE_FIELD(layout)
@@ -82,8 +86,8 @@ struct DeconvolutionParam : public dmlc::Parameter<DeconvolutionParam> {
8286
.add_enum("NHWC", mshadow::kNHWC)
8387
.add_enum("NDHWC", mshadow::kNDHWC)
8488
.set_default(dmlc::optional<int>())
85-
.describe("Set layout for input, output and weight. Empty for\n "
86-
"default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.");
89+
.describe("Set layout for input, output and weight. Empty for "
90+
"default layout, NCW for 1d, NCHW for 2d and NCDHW for 3d.");
8791
}
8892

8993
template<size_t ndim>

src/operator/deconvolution.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ Operator* DeconvolutionProp::CreateOperatorEx(Context ctx, std::vector<TShape> *
3333
DMLC_REGISTER_PARAMETER(DeconvolutionParam);
3434

3535
MXNET_REGISTER_OP_PROPERTY(Deconvolution, DeconvolutionProp)
36-
.add_argument("data", "NDArray-or-Symbol", "Input data to the DeconvolutionOp.")
37-
.add_argument("weight", "NDArray-or-Symbol", "Weight matrix.")
38-
.add_argument("bias", "NDArray-or-Symbol", "Bias parameter.")
36+
.add_argument("data", "NDArray-or-Symbol", "Input tensor to the deconvolution operation.")
37+
.add_argument("weight", "NDArray-or-Symbol", "Weights representing the kernel.")
38+
.add_argument("bias", "NDArray-or-Symbol", "Bias added to the result after the deconvolution "
39+
"operation.")
3940
.add_arguments(DeconvolutionParam::__FIELDS__())
40-
.describe("Applies deconvolution to input and adds a bias.");
41+
.describe("Computes 2D transposed convolution (aka fractionally strided convolution) of the "
42+
"input tensor. This operation can be seen as the gradient of Convolution operation with "
43+
"respect to its input. Convolution usually reduces the size of the input. Transposed "
44+
"convolution works the other way, going from a smaller input to a larger output while "
45+
"preserving the connectivity pattern.");
4146

4247
} // namespace op
4348
} // namespace mxnet

0 commit comments

Comments
 (0)