MaxPool2d

class dragon.vm.torch.nn.MaxPool2d(
  kernel_size,
  stride=1,
  padding=0,
  ceil_mode=False,
  global_pooling=False
)[source]

Apply the 2d max pooling to input.

The spatial output dimension is computed as:

\[\text{Dim}_{out} = (\text{Dim}_{in} + 2 * pad - \text{K}_{size}) / stride + 1 \]

Examples:

m = torch.nn.MaxPool2d(2, 2)
x = torch.ones(2, 2, 4, 4)
y = m(x)

__init__

MaxPool2d.__init__(
  kernel_size,
  stride=1,
  padding=0,
  ceil_mode=False,
  global_pooling=False
)[source]

Create a MaxPool2d module.

Parameters:
  • kernel_size (Union[int, Sequence[int]]) – The size of sliding window.
  • stride (Union[int, Sequence[int]], optional, default=1) – The stride of sliding window.
  • padding (Union[int, Sequence[int]], optional, default=0) – The zero-padding size.
  • ceil_mode (bool, optional, default=False) – Ceil or floor the boundary.
  • global_pooling (bool, optional) – True to pool globally regardless of kernel_size.