未验证 提交 1064f2b8 编写于 作者: W wangxinxin08 提交者: GitHub

modify conv2d_transpose docs (#32410)

* modify conv2d_transpose docs
上级 bec4b167
...@@ -414,7 +414,7 @@ def conv2d(x, ...@@ -414,7 +414,7 @@ def conv2d(x,
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -441,8 +441,8 @@ def conv2d(x, ...@@ -441,8 +441,8 @@ def conv2d(x,
.. math:: .. math::
H_{out}&= \\frac{(H_{in} + 2 * paddings[0] - (dilations[0] * (H_f - 1) + 1))}{strides[0]} + 1 \\\\ H_{out}&= \frac{(H_{in} + 2 * paddings[0] - (dilations[0] * (H_f - 1) + 1))}{strides[0]} + 1 \\\\
W_{out}&= \\frac{(W_{in} + 2 * paddings[1] - (dilations[1] * (W_f - 1) + 1))}{strides[1]} + 1 W_{out}&= \frac{(W_{in} + 2 * paddings[1] - (dilations[1] * (W_f - 1) + 1))}{strides[1]} + 1
Args: Args:
x (Tensor): The input is 4-D Tensor with shape [N, C, H, W], the data type x (Tensor): The input is 4-D Tensor with shape [N, C, H, W], the data type
...@@ -627,7 +627,7 @@ def conv1d_transpose(x, ...@@ -627,7 +627,7 @@ def conv1d_transpose(x,
so for conv1d_transpose, when stride > 1, input shape maps multiple output shape. so for conv1d_transpose, when stride > 1, input shape maps multiple output shape.
If output_size is None, :math:`L_{out} = L^\prime_{out}`; If output_size is None, :math:`L_{out} = L^\prime_{out}`;
else, the :math:`L_{out}` of the output size must between :math:`L^\prime_{out}` else, the :math:`L_{out}` of the output size must between :math:`L^\prime_{out}`
and :math:`L^\prime_{out} + stride`. conv1d_transpose can compute the kernel size automatically. and :math:`L^\prime_{out} + stride`.
Args: Args:
x(Tensor): 3-D tensor with [N, C, L] or [N, L, C] format, x(Tensor): 3-D tensor with [N, C, L] or [N, L, C] format,
...@@ -657,10 +657,7 @@ def conv1d_transpose(x, ...@@ -657,10 +657,7 @@ def conv1d_transpose(x,
Default: dilation = 1. Default: dilation = 1.
output_size(int|tuple|list, optional): The output image size. If output size is a output_size(int|tuple|list, optional): The output image size. If output size is a
tuple, it must contain one integer, `(feature_length)`. None if use tuple, it must contain one integer, `(feature_length)`. None if use
filter_size, padding, and stride to calculate output_size. filter_size(shape of weight), padding, and stride to calculate output_size.
If output_size and filter_size are specified at the same time, They
should follow the formula above. Default: None. output_size and filter_size
should not be None at the same time.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCL"`, `"NLC"`. will be consistent with that of the input. An optional string from: `"NCL"`, `"NLC"`.
The default is `"NCL"`. When it is `"NCL"`, the data is stored in the order of: The default is `"NCL"`. When it is `"NCL"`, the data is stored in the order of:
...@@ -854,7 +851,7 @@ def conv2d_transpose(x, ...@@ -854,7 +851,7 @@ def conv2d_transpose(x,
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -893,8 +890,7 @@ def conv2d_transpose(x, ...@@ -893,8 +890,7 @@ def conv2d_transpose(x,
If output_size is None, :math:`H_{out} = H^\prime_{out}, W_{out} = W^\prime_{out}`; If output_size is None, :math:`H_{out} = H^\prime_{out}, W_{out} = W^\prime_{out}`;
else, the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}` else, the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}`
and :math:`H^\prime_{out} + strides[0]`, and the :math:`W_{out}` of the output size must and :math:`H^\prime_{out} + strides[0]`, and the :math:`W_{out}` of the output size must
between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[1]`, between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[1]`.
conv2d_transpose can compute the kernel size automatically.
Args: Args:
x(Tensor): 4-D Tensor with [N, C, H, W] or [N, H, W, C] format, x(Tensor): 4-D Tensor with [N, C, H, W] or [N, H, W, C] format,
...@@ -929,10 +925,7 @@ def conv2d_transpose(x, ...@@ -929,10 +925,7 @@ def conv2d_transpose(x,
Otherwise, dilation_height = dilation_width = dilation. Default: dilation = 1. Otherwise, dilation_height = dilation_width = dilation. Default: dilation = 1.
output_size(int|tuple|list, optional): The output image size. If output size is a output_size(int|tuple|list, optional): The output image size. If output size is a
tuple, it must contain two integers, (image_height, image_width). None if use tuple, it must contain two integers, (image_height, image_width). None if use
filter_size, padding, and stride to calculate output_size. filter_size(shape of weight), padding, and stride to calculate output_size.
If output_size is specified, output_size and filter_size (weight)'s shape
should follow the formula above. Default: None. output_size and filter_size
should not be None at the same time.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`. will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`.
The default is `"NCHW"`. When it is `"NCHW"`, the data is stored in the order of: The default is `"NCHW"`. When it is `"NCHW"`, the data is stored in the order of:
...@@ -1090,7 +1083,7 @@ def conv3d(x, ...@@ -1090,7 +1083,7 @@ def conv3d(x,
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
In the above equation: In the above equation:
...@@ -1246,7 +1239,7 @@ def conv3d_transpose(x, ...@@ -1246,7 +1239,7 @@ def conv3d_transpose(x,
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
In the above equation: In the above equation:
...@@ -1289,8 +1282,7 @@ def conv3d_transpose(x, ...@@ -1289,8 +1282,7 @@ def conv3d_transpose(x,
size must between :math:`D^\prime_{out}` and :math:`D^\prime_{out} + strides[0]`, size must between :math:`D^\prime_{out}` and :math:`D^\prime_{out} + strides[0]`,
the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}` the :math:`H_{out}` of the output size must between :math:`H^\prime_{out}`
and :math:`H^\prime_{out} + strides[1]`, and the :math:`W_{out}` of the output size must and :math:`H^\prime_{out} + strides[1]`, and the :math:`W_{out}` of the output size must
between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[2]`, between :math:`W^\prime_{out}` and :math:`W^\prime_{out} + strides[2]`.
conv3d_transpose can compute the kernel size automatically.
Args: Args:
x(Tensor): The input is 5-D Tensor with shape [N, C, D, H, W] or [N, D, H, W, C], the data type x(Tensor): The input is 5-D Tensor with shape [N, C, D, H, W] or [N, D, H, W, C], the data type
...@@ -1326,10 +1318,8 @@ def conv3d_transpose(x, ...@@ -1326,10 +1318,8 @@ def conv3d_transpose(x,
dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation. dilation_width). Otherwise, dilation_depth = dilation_height = dilation_width = dilation.
Default: dilation = 1. Default: dilation = 1.
output_size(int|list|tuple, optional): The output image size. If output size is a output_size(int|list|tuple, optional): The output image size. If output size is a
tuple, it must contain three integers, (image_depth, image_height, image_width). This tuple, it must contain three integers, (image_depth, image_height, image_width).
parameter only works when filter_size is None. If output_size and filter_size are None if use filter_size(shape of weight), padding, and stride to calculate output_size.
specified at the same time, They should follow the formula above. Default: None.
Output_size and filter_size should not be None at the same time.
data_format (str, optional): Specify the data format of the input, and the data format of the output data_format (str, optional): Specify the data format of the input, and the data format of the output
will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`. will be consistent with that of the input. An optional string from: `"NCHW"`, `"NHWC"`.
The default is `"NCHW"`. When it is `"NCHW"`, the data is stored in the order of: The default is `"NCHW"`. When it is `"NCHW"`, the data is stored in the order of:
......
...@@ -199,7 +199,7 @@ class Conv1D(_ConvNd): ...@@ -199,7 +199,7 @@ class Conv1D(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -226,7 +226,7 @@ class Conv1D(_ConvNd): ...@@ -226,7 +226,7 @@ class Conv1D(_ConvNd):
.. math:: .. math::
L_{out}&= \\frac{(L_{in} + 2 * padding - (dilation * (L_f - 1) + 1))}{stride} + 1 L_{out}&= \frac{(L_{in} + 2 * padding - (dilation * (L_f - 1) + 1))}{stride} + 1 \\
Parameters: Parameters:
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
...@@ -258,7 +258,7 @@ class Conv1D(_ConvNd): ...@@ -258,7 +258,7 @@ class Conv1D(_ConvNd):
of conv1d. If it is set to None or one attribute of ParamAttr, conv1d of conv1d. If it is set to None or one attribute of ParamAttr, conv1d
will create ParamAttr as param_attr. If the Initializer of the param_attr will create ParamAttr as param_attr. If the Initializer of the param_attr
is not set, the parameter is initialized with :math:`Normal(0.0, std)`, is not set, the parameter is initialized with :math:`Normal(0.0, std)`,
and the :math:`std` is :math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`. Default: None. and the :math:`std` is :math:`(\frac{2.0 }{filter\_elem\_num})^{0.5}`. Default: None.
bias_attr (ParamAttr or bool, optional): The attribute for the bias of conv1d. bias_attr (ParamAttr or bool, optional): The attribute for the bias of conv1d.
If it is set to False, no bias will be added to the output units. If it is set to False, no bias will be added to the output units.
If it is set to None or one attribute of ParamAttr, conv1d If it is set to None or one attribute of ParamAttr, conv1d
...@@ -368,7 +368,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -368,7 +368,7 @@ class Conv1DTranspose(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -404,7 +404,7 @@ class Conv1DTranspose(_ConvNd): ...@@ -404,7 +404,7 @@ class Conv1DTranspose(_ConvNd):
so for conv1d_transpose, when stride > 1, input shape maps multiple output shape. so for conv1d_transpose, when stride > 1, input shape maps multiple output shape.
If output_size is None, :math:`L_{out} = L^\prime_{out}`; If output_size is None, :math:`L_{out} = L^\prime_{out}`;
else, the :math:`L_{out}` of the output size must between :math:`L^\prime_{out}` else, the :math:`L_{out}` of the output size must between :math:`L^\prime_{out}`
and :math:`L^\prime_{out} + stride`. conv1d_transpose can compute the kernel size automatically. and :math:`L^\prime_{out} + stride`.
Args: Args:
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
...@@ -540,7 +540,7 @@ class Conv2D(_ConvNd): ...@@ -540,7 +540,7 @@ class Conv2D(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -578,7 +578,7 @@ class Conv2D(_ConvNd): ...@@ -578,7 +578,7 @@ class Conv2D(_ConvNd):
of conv2d. If it is set to None or one attribute of ParamAttr, conv2d of conv2d. If it is set to None or one attribute of ParamAttr, conv2d
will create ParamAttr as param_attr. If it is set to None, the parameter will create ParamAttr as param_attr. If it is set to None, the parameter
is initialized with :math:`Normal(0.0, std)`, and the :math:`std` is is initialized with :math:`Normal(0.0, std)`, and the :math:`std` is
:math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`. The default value is None. :math:`(\frac{2.0 }{filter\_elem\_num})^{0.5}`. The default value is None.
bias_attr(ParamAttr|bool, optional): The parameter attribute for the bias of conv2d. bias_attr(ParamAttr|bool, optional): The parameter attribute for the bias of conv2d.
If it is set to False, no bias will be added to the output units. If it is set to False, no bias will be added to the output units.
If it is set to None or one attribute of ParamAttr, conv2d If it is set to None or one attribute of ParamAttr, conv2d
...@@ -603,9 +603,9 @@ class Conv2D(_ConvNd): ...@@ -603,9 +603,9 @@ class Conv2D(_ConvNd):
.. math:: .. math::
H_{out}&= \\frac{(H_{in} + 2 * paddings[0] - (dilations[0] * (kernel\_size[0] - 1) + 1))}{strides[0]} + 1 H_{out}&= \frac{(H_{in} + 2 * paddings[0] - (dilations[0] * (kernel\_size[0] - 1) + 1))}{strides[0]} + 1
W_{out}&= \\frac{(W_{in} + 2 * paddings[1] - (dilations[1] * (kernel\_size[1] - 1) + 1))}{strides[1]} + 1 W_{out}&= \frac{(W_{in} + 2 * paddings[1] - (dilations[1] * (kernel\_size[1] - 1) + 1))}{strides[1]} + 1
Examples: Examples:
...@@ -696,7 +696,7 @@ class Conv2DTranspose(_ConvNd): ...@@ -696,7 +696,7 @@ class Conv2DTranspose(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
Where: Where:
...@@ -710,7 +710,7 @@ class Conv2DTranspose(_ConvNd): ...@@ -710,7 +710,7 @@ class Conv2DTranspose(_ConvNd):
Parameters: Parameters:
in_channels(int): The number of channels in the input image. in_channels(int): The number of channels in the input image.
out_channels(int): The number of channels produced by the convolution. out_channels(int): The number of channels produced by the convolution.
kernel_size(int|list|uple): The kernel size. If kernel_size is a tuple, kernel_size(int|list|tuple): The kernel size. If kernel_size is a tuple,
it must contain two integers, (kernel_size_H, kernel_size_W). it must contain two integers, (kernel_size_H, kernel_size_W).
Otherwise, the kernel will be a square. Otherwise, the kernel will be a square.
stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must stride(int|list|tuple, optional): The stride size. If stride is a tuple, it must
...@@ -851,7 +851,7 @@ class Conv3D(_ConvNd): ...@@ -851,7 +851,7 @@ class Conv3D(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
In the above equation: In the above equation:
...@@ -889,7 +889,7 @@ class Conv3D(_ConvNd): ...@@ -889,7 +889,7 @@ class Conv3D(_ConvNd):
of conv3d. If it is set to None or one attribute of ParamAttr, conv3d of conv3d. If it is set to None or one attribute of ParamAttr, conv3d
will create ParamAttr as param_attr. If it is set to None, the parameter will create ParamAttr as param_attr. If it is set to None, the parameter
is initialized with :math:`Normal(0.0, std)`, and the :math:`std` is is initialized with :math:`Normal(0.0, std)`, and the :math:`std` is
:math:`(\\frac{2.0 }{filter\_elem\_num})^{0.5}`. The default value is None. :math:`(\frac{2.0 }{filter\_elem\_num})^{0.5}`. The default value is None.
bias_attr(ParamAttr|bool, optional): The parameter attribute for the bias of conv3d. bias_attr(ParamAttr|bool, optional): The parameter attribute for the bias of conv3d.
If it is set to False, no bias will be added to the output units. If it is set to False, no bias will be added to the output units.
If it is set to None or one attribute of ParamAttr, conv3d If it is set to None or one attribute of ParamAttr, conv3d
...@@ -914,11 +914,11 @@ class Conv3D(_ConvNd): ...@@ -914,11 +914,11 @@ class Conv3D(_ConvNd):
.. math:: .. math::
D_{out}&= \\frac{(D_{in} + 2 * paddings[0] - (dilations[0] * (kernel\_size[0] - 1) + 1))}{strides[0]} + 1 D_{out}&= \frac{(D_{in} + 2 * paddings[0] - (dilations[0] * (kernel\_size[0] - 1) + 1))}{strides[0]} + 1
H_{out}&= \\frac{(H_{in} + 2 * paddings[1] - (dilations[1] * (kernel\_size[1] - 1) + 1))}{strides[1]} + 1 H_{out}&= \frac{(H_{in} + 2 * paddings[1] - (dilations[1] * (kernel\_size[1] - 1) + 1))}{strides[1]} + 1
W_{out}&= \\frac{(W_{in} + 2 * paddings[2] - (dilations[2] * (kernel\_size[2] - 1) + 1))}{strides[2]} + 1 W_{out}&= \frac{(W_{in} + 2 * paddings[2] - (dilations[2] * (kernel\_size[2] - 1) + 1))}{strides[2]} + 1
Raises: Raises:
ValueError: If the shapes of input, filter_size, stride, padding and ValueError: If the shapes of input, filter_size, stride, padding and
...@@ -1010,7 +1010,7 @@ class Conv3DTranspose(_ConvNd): ...@@ -1010,7 +1010,7 @@ class Conv3DTranspose(_ConvNd):
.. math:: .. math::
Out = \sigma (W \\ast X + b) Out = \sigma (W \ast X + b)
In the above equation: In the above equation:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册