copapy.nn.max_pool1d#

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

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

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

  • kernel_size (int) – Size of the window.

  • stride (int | None) – Step of the window, the default is the kernel size.

  • padding (int) – Padding on both sides of the input, 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_length) with a leading batch dimension if x has one.