copapy.nn.max_pool2d#

copapy.nn.max_pool2d(x, kernel_size, stride=None, padding=0)#

2D max pooling: the largest element of each window, computed by a single array stencil.

Parameters:
  • x (TArr) – Input of shape (channels, height, width) or (batch, channels, height, width).

  • kernel_size (int | Sequence[int]) – Size of the window, a single integer or (vertical, horizontal).

  • stride (int | Sequence[int] | None) – Step of the window, a single integer or (vertical, horizontal). The default is the kernel size (windows without overlap).

  • padding (int | Sequence[int]) – Padding on both sides of the input, a single integer or (vertical, horizontal), at most half the kernel size. Padded elements are ignored.

Return type:

TArr

Returns:

Float array or tensor (same type as x) of shape (channels, out_height, out_width) with a leading batch dimension if x has one.