Skip to content

Commit 385913b

Browse files
Atcoldsoumith
authored andcommitted
Fix class torch.nn.ConvTransposeNd documentation (pytorch#739)
There is no `dilation` `output_padding` doc was missing
1 parent 6aaa14f commit 385913b

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

torch/nn/modules/conv.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,14 @@ class ConvTranspose1d(_ConvTransposeMixin, _ConvNd):
391391
kernel_size (int or tuple): Size of the convolving kernel
392392
stride (int or tuple, optional): Stride of the convolution
393393
padding (int or tuple, optional): Zero-padding added to both sides of the input
394-
dilation (int or tuple, optional): Spacing between kernel elements
394+
output_padding (int or tuple, optional): Zero-padding added to one side of the output
395395
groups (int, optional): Number of blocked connections from input channels to output channels
396396
bias (bool, optional): If True, adds a learnable bias to the output
397397
398398
Shape:
399399
- Input: :math:`(N, C_{in}, L_{in})`
400400
- Output: :math:`(N, C_{out}, L_{out})` where
401-
:math:`L_{out} = (L_{in} - 1) * stride - 2 * padding + kernel_size + output_padding`
401+
:math:`L_{out} = (L_{in} - 1) * stride - 2 * padding + kernel\_size + output\_padding`
402402
403403
Attributes:
404404
weight (Tensor): the learnable weights of the module of shape
@@ -434,8 +434,8 @@ class ConvTranspose2d(_ConvTransposeMixin, _ConvNd):
434434
| :attr:`stride` controls the stride for the cross-correlation.
435435
| If :attr:`padding` is non-zero, then the input is implicitly zero-padded on both sides
436436
for :attr:`padding` number of points
437-
| If :attr:`padding` is non-zero, then the output is implicitly zero-padded on both sides
438-
for :attr:`padding` number of points
437+
| If :attr:`output_padding` is non-zero, then the output is implicitly zero-padded on one side
438+
for :attr:`output_padding` number of points
439439
| :attr:`dilation` controls the spacing between the kernel points. It is harder to describe,
440440
but this `link`_ has a nice visualization of what :attr:`dilation` does.
441441
| :attr:`groups` controls the connections between inputs and outputs.
@@ -444,8 +444,8 @@ class ConvTranspose2d(_ConvTransposeMixin, _ConvNd):
444444
side by side, each seeing half the input channels,
445445
and producing half the output channels, and both subsequently concatenated.
446446
447-
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding`, :attr:`output_padding`,
448-
:attr:`dilation` can either be:
447+
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding`, :attr:`output_padding`
448+
can either be:
449449
450450
- a single ``int`` -- in which case the same value is used for the height and width dimension
451451
- a ``tuple`` of two ints -- in which case, the first `int` is used for the height dimension,
@@ -464,15 +464,15 @@ class ConvTranspose2d(_ConvTransposeMixin, _ConvNd):
464464
kernel_size (int or tuple): Size of the convolving kernel
465465
stride (int or tuple, optional): Stride of the convolution
466466
padding (int or tuple, optional): Zero-padding added to both sides of the input
467-
dilation (int or tuple, optional): Spacing between kernel elements
467+
output_padding (int or tuple, optional): Zero-padding added to one side of the output
468468
groups (int, optional): Number of blocked connections from input channels to output channels
469469
bias (bool, optional): If True, adds a learnable bias to the output
470470
471471
Shape:
472472
- Input: :math:`(N, C_{in}, H_{in}, W_{in})`
473473
- Output: :math:`(N, C_{out}, H_{out}, W_{out})` where
474-
:math:`H_{out} = (H_{in} - 1) * stride[0] - 2 * padding[0] + kernel_size[0] + output_padding[0]`
475-
:math:`W_{out} = (W_{in} - 1) * stride[1] - 2 * padding[1] + kernel_size[1] + output_padding[1]`
474+
:math:`H_{out} = (H_{in} - 1) * stride[0] - 2 * padding[0] + kernel\_size[0] + output\_padding[0]`
475+
:math:`W_{out} = (W_{in} - 1) * stride[1] - 2 * padding[1] + kernel\_size[1] + output\_padding[1]`
476476
477477
Attributes:
478478
weight (Tensor): the learnable weights of the module of shape
@@ -535,18 +535,16 @@ class ConvTranspose3d(_ConvTransposeMixin, _ConvNd):
535535
| :attr:`stride` controls the stride for the cross-correlation.
536536
| If :attr:`padding` is non-zero, then the input is implicitly zero-padded on both sides
537537
for :attr:`padding` number of points
538-
| If :attr:`padding` is non-zero, then the output is implicitly zero-padded on both sides
539-
for :attr:`padding` number of points
540-
| :attr:`dilation` controls the spacing between the kernel points. It is harder to describe,
541-
but this `link`_ has a nice visualization of what :attr:`dilation` does.
538+
| If :attr:`output_padding` is non-zero, then the output is implicitly zero-padded on one side
539+
for :attr:`output_padding` number of points
542540
| :attr:`groups` controls the connections between inputs and outputs.
543541
| At groups=1, all inputs are convolved to all outputs.
544542
| At groups=2, the operation becomes equivalent to having two conv layers
545543
side by side, each seeing half the input channels,
546544
and producing half the output channels, and both subsequently concatenated.
547545
548-
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding`, :attr:`output_padding`,
549-
:attr:`dilation` can either be:
546+
The parameters :attr:`kernel_size`, :attr:`stride`, :attr:`padding`, :attr:`output_padding`
547+
can either be:
550548
551549
- a single ``int`` -- in which case the same value is used for the height and width dimension
552550
- a ``tuple`` of three ints -- in which case, the first `int` is used for the depth dimension,
@@ -565,16 +563,16 @@ class ConvTranspose3d(_ConvTransposeMixin, _ConvNd):
565563
kernel_size (int or tuple): Size of the convolving kernel
566564
stride (int or tuple, optional): Stride of the convolution
567565
padding (int or tuple, optional): Zero-padding added to both sides of the input
568-
dilation (int or tuple, optional): Spacing between kernel elements
566+
output_padding (int or tuple, optional): Zero-padding added to one side of the output
569567
groups (int, optional): Number of blocked connections from input channels to output channels
570568
bias (bool, optional): If True, adds a learnable bias to the output
571569
572570
Shape:
573571
- Input: :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})`
574572
- Output: :math:`(N, C_{out}, D_{out}, H_{out}, W_{out})` where
575-
:math:`D_{out} = (D_{in} - 1) * stride[0] - 2 * padding[0] + kernel_size[0] + output_padding[0]`
576-
:math:`H_{out} = (H_{in} - 1) * stride[1] - 2 * padding[1] + kernel_size[1] + output_padding[1]`
577-
:math:`W_{out} = (W_{in} - 1) * stride[2] - 2 * padding[2] + kernel_size[2] + output_padding[2]`
573+
:math:`D_{out} = (D_{in} - 1) * stride[0] - 2 * padding[0] + kernel\_size[0] + output\_padding[0]`
574+
:math:`H_{out} = (H_{in} - 1) * stride[1] - 2 * padding[1] + kernel\_size[1] + output\_padding[1]`
575+
:math:`W_{out} = (W_{in} - 1) * stride[2] - 2 * padding[2] + kernel\_size[2] + output\_padding[2]`
578576
579577
Attributes:
580578
weight (Tensor): the learnable weights of the module of shape

0 commit comments

Comments
 (0)