Skip to content

Commit 1335b7c

Browse files
ngimelsoumith
authored andcommitted
Fix unpooling docs (pytorch#492)
1 parent 6d14ef8 commit 1335b7c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

torch/nn/modules/pooling.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,9 @@ class MaxUnpool1d(Module):
169169
padding (int or tuple): Padding that was added to the input
170170
171171
Shape:
172-
- Input: :math:`(N, C, H_{in}, W_{in})`
173-
- Output: :math:`(N, C, H_{out}, W_{out})` where
174-
:math:`H_{out} = padding[0] * (H_{in} - 1) * stride[0] + kernel\_size[0]`
175-
:math:`W_{out} = padding[1] * (W_{in} - 1) * stride[1] + kernel\_size[1]`
172+
- Input: :math:`(N, C, H_{in})`
173+
- Output: :math:`(N, C, H_{out})` where
174+
:math:`H_{out} = (H_{in} - 1) * stride[0] - 2 * padding[0] + kernel\_size[0]`
176175
or as given by :attr:`output_size` in the call operator
177176
178177
Example:
@@ -214,8 +213,8 @@ class MaxUnpool2d(Module):
214213
Shape:
215214
- Input: :math:`(N, C, H_{in}, W_{in})`
216215
- Output: :math:`(N, C, H_{out}, W_{out})` where
217-
:math:`H_{out} = padding[0] * (H_{in} - 1) * stride[0] + kernel\_size[0]`
218-
:math:`W_{out} = padding[1] * (W_{in} - 1) * stride[1] + kernel\_size[1]`
216+
:math:`H_{out} = (H_{in} - 1) * stride[0] -2 * padding[0] + kernel\_size[0]`
217+
:math:`W_{out} = (W_{in} - 1) * stride[1] -2 * padding[1] + kernel\_size[1]`
219218
or as given by :attr:`output_size` in the call operator
220219
221220
Example:
@@ -263,9 +262,9 @@ class MaxUnpool3d(Module):
263262
Shape:
264263
- Input: :math:`(N, C, D_{in}, H_{in}, W_{in})`
265264
- Output: :math:`(N, C, D_{out}, H_{out}, W_{out})` where
266-
:math:`D_{out} = padding[0] * (D_{in} - 1) * stride[0] + kernel\_size[0]`
267-
:math:`H_{out} = padding[1] * (H_{in} - 1) * stride[1] + kernel\_size[1]`
268-
:math:`W_{out} = padding[2] * (W_{in} - 1) * stride[2] + kernel\_size[2]`
265+
:math:`D_{out} = (D_{in} - 1) * stride[0] - 2 * padding[0] + kernel\_size[0]`
266+
:math:`H_{out} = (H_{in} - 1) * stride[1] - 2 * padding[1] + kernel\_size[1]`
267+
:math:`W_{out} = (W_{in} - 1) * stride[2] - 2 * padding[2] + kernel\_size[2]`
269268
or as given by :attr:`output_size` in the call operator
270269
271270
Example::

0 commit comments

Comments
 (0)