Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions torch/nn/modules/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,9 @@ class AdaptiveMaxPool2d(Module):

Args:
output_size: the target output size of the image of the form H x W.
Can be a tuple (H, W) or a single number H for a square image H x H
Can be a tuple (H, W) or a single H for a square image H x H.
H and W can be either a ``int``, or ``None`` which means the size will
be the same as that of the input.
return_indices: if ``True``, will return the indices along with the outputs.
Useful to pass to nn.MaxUnpool2d. Default: ``False``

Expand All @@ -884,6 +886,10 @@ class AdaptiveMaxPool2d(Module):
>>> m = nn.AdaptiveMaxPool2d(7)
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9))
>>> output = m(input)
>>> # target output size of 10x7
>>> m = nn.AdaptiveMaxPool2d((None, 7))
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9))
>>> output = m(input)

"""

Expand All @@ -908,7 +914,10 @@ class AdaptiveMaxPool3d(Module):

Args:
output_size: the target output size of the image of the form D x H x W.
Can be a tuple (D, H, W) or a single number D for a cube D x D x D
Can be a tuple (D, H, W) or a single D for a cube D x D x D.
D, H and W can be either a ``int``, or ``None`` which means the size will
be the same as that of the input.

return_indices: if ``True``, will return the indices along with the outputs.
Useful to pass to nn.MaxUnpool3d. Default: ``False``

Expand All @@ -921,6 +930,10 @@ class AdaptiveMaxPool3d(Module):
>>> m = nn.AdaptiveMaxPool3d(7)
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9, 8))
>>> output = m(input)
>>> # target output size of 7x9x8
>>> m = nn.AdaptiveMaxPool3d((7, None, None))
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9, 8))
>>> output = m(input)

"""

Expand Down Expand Up @@ -974,7 +987,9 @@ class AdaptiveAvgPool2d(Module):

Args:
output_size: the target output size of the image of the form H x W.
Can be a tuple (H, W) or a single number H for a square image H x H
Can be a tuple (H, W) or a single H for a square image H x H
H and W can be either a ``int``, or ``None`` which means the size will
be the same as that of the input.

Examples:
>>> # target output size of 5x7
Expand All @@ -985,6 +1000,10 @@ class AdaptiveAvgPool2d(Module):
>>> m = nn.AdaptiveAvgPool2d(7)
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9))
>>> output = m(input)
>>> # target output size of 10x7
>>> m = nn.AdaptiveMaxPool2d((None, 7))
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9))
>>> output = m(input)

"""

Expand All @@ -1009,6 +1028,8 @@ class AdaptiveAvgPool3d(Module):
Args:
output_size: the target output size of the form D x H x W.
Can be a tuple (D, H, W) or a single number D for a cube D x D x D
D, H and W can be either a ``int``, or ``None`` which means the size will
be the same as that of the input.

Examples:
>>> # target output size of 5x7x9
Expand All @@ -1019,6 +1040,10 @@ class AdaptiveAvgPool3d(Module):
>>> m = nn.AdaptiveAvgPool3d(7)
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9, 8))
>>> output = m(input)
>>> # target output size of 7x9x8
>>> m = nn.AdaptiveMaxPool3d((7, None, None))
>>> input = autograd.Variable(torch.randn(1, 64, 10, 9, 8))
>>> output = m(input)

"""

Expand Down