!49902 fix conv2dtranspose doc

Merge pull request !49902 from chenkang/ck_fixdoc
This commit is contained in:
i-robot 2023-03-08 06:17:54 +00:00 committed by Gitee
commit 866e06505b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@ mindspore.nn.Conv2dTranspose
- **pad**:对输入进行填充。在输入的高度和宽度方向上填充 `padding` 大小的0。如果设置此模式 `padding` 必须大于或等于0。
- **padding** (Union[int, tuple[int]]) - 输入的高度和宽度方向上填充的数量。数据类型为整型或包含四个整数的tuple。如果 `padding` 是一个整数,那么上、下、左、右的填充都等于 `padding` 。如果 `padding` 是一个有四个整数的tuple那么上、下、左、右的填充分别等于 `padding[0]``padding[1]``padding[2]``padding[3]` 。值应该要大于等于0默认值0。
- **output_padding** (Union[int, tuple[int]]) - 输的高度和宽度方向上填充的数量。数据类型为整型或包含两个整数的tuple。如果 `output_padding` 是一个整数,那么下、右的填充都等于 `output_padding` 。如果 `output_padding` 是一个有两个整数的tuple那么下、右的填充分别等于 `output_padding[0]``output_padding[1]`值应该要大于等于0默认值0。
- **output_padding** (Union[int, tuple[int]]) - 输的高度和宽度方向上填充的数量。数据类型为整型或包含两个整数的tuple。如果 `output_padding` 是一个整数,那么下、右的填充都等于 `output_padding` 。如果 `output_padding` 是一个有两个整数的tuple那么下、右的填充分别等于 `output_padding[0]``output_padding[1]`如果 `output_padding` 不为0 `pad_mode` 必须为 `pad``output_padding` 取值范围为 `[0, max(stride, dilation))` 默认值0。
- **dilation** (Union[int, tuple[int]]) - 二维卷积核膨胀尺寸。数据类型为整型或具有两个整型的tuple。若 :math:`k > 1` 则kernel间隔 `k` 个元素进行采样。高度和宽度方向上的 `k` ,其取值范围分别为[1, H]和[1, W]。默认值1。
- **group** (int) - 将过滤器拆分为组, `in_channels``out_channels` 必须可被 `group` 整除。如果组数等于 `in_channels``out_channels` 这个二维卷积层也被称为二维深度卷积层。默认值1.
- **has_bias** (bool) - Conv2dTranspose层是否添加偏置参数。默认值False。

View File

@ -968,7 +968,8 @@ class Conv2dTranspose(_Conv):
The data type is an integer or a tuple of two integers. If `output_padding` is an integer,
then the bottom and right padding are all equal to `output_padding`. If `output_padding` is a tuple of
2 integers, then the bottom and right padding is equal to `output_padding[0]`, `output_padding[1]`
respectively. The value should be greater than or equal to 0. Default: 0.
respectively. If `output_padding` is not equal to 0, `pad_mode` must be `pad`.
The value should be in range of `[0, max(stride, dilation))` . Default: 0.
dilation (Union[int, tuple[int]]): Dilation size of 2D convolution kernel.
The data type is an integer or a tuple of two integers. If :math:`k > 1`, the kernel is sampled
every `k` elements. The value of `k` on the height and width directions is in range of [1, H]
@ -1124,9 +1125,9 @@ class Conv2dTranspose(_Conv):
conv2d_trans_ret = self.conv2d_transpose(x, self.weight, (n, self.out_channels, h_out, w_out))
if isinstance(self.output_padding, tuple):
if self.output_padding[0] < 0 or self.output_padding[0] >= max(self.dilation[0], self.stride[0]):
raise ValueError("output_padding[0] must be in range of [0, max(stride_d, dilation_d)).")
raise ValueError("output_padding[0] must be in range of [0, max(stride_h, dilation_h)).")
if self.output_padding[1] < 0 or self.output_padding[1] >= max(self.dilation[1], self.stride[1]):
raise ValueError("output_padding[1] must be in range of [0, max(stride_d, dilation_d)).")
raise ValueError("output_padding[1] must be in range of [0, max(stride_w, dilation_w)).")
if not self.is_pad and (self.output_padding[0] > 0 or self.output_padding[1] > 0):
raise ValueError("when output_padding is not zero, pad_mode must be 'pad'")
@ -1137,9 +1138,9 @@ class Conv2dTranspose(_Conv):
return conv2d_trans_ret
if self.output_padding < 0 or self.output_padding >= max(self.dilation[0], self.stride[0]):
raise ValueError("output_padding must be in range of [0, max(stride_d, dilation_d)).")
raise ValueError("output_padding must be in range of [0, max(stride_h, dilation_h)).")
if self.output_padding < 0 or self.output_padding >= max(self.dilation[1], self.stride[1]):
raise ValueError("output_padding must be in range of [0, max(stride_d, dilation_d)).")
raise ValueError("output_padding must be in range of [0, max(stride_w, dilation_w)).")
if not self.is_pad and self.output_padding > 0:
raise ValueError("when output_padding is not zero, pad_mode must be 'pad'")
pad = P.Pad(paddings=((0, 0), (0, 0), (0, self.output_padding), (0, self.output_padding)))