Rate this Page
★ ★ ★ ★ ★

torch.nn.functional.lp_pool1d#

torch.nn.functional.lp_pool1d(input, norm_type, kernel_size, stride=None, ceil_mode=False)[source]#

Apply a 1D power-average pooling over an input signal composed of several input planes.

If the sum of all inputs to the power of p is zero, the gradient is set to zero as well.

When ceil_mode is True, sliding windows may go off-bounds if they start within the left padding or the input. Sliding windows that would start in the right padded region are ignored.

See LPPool1d for details.

Parameters:
  • input (Tensor) – the input tensor.

  • norm_type (int or float) – the power pp used to compute pooling. Must be non-zero; positive and negative infinity are supported.

  • kernel_size (int) – the size of the pooling window.

  • stride (int or tuple of int, optional) – the stride between windows. Default: kernel_size.

  • ceil_mode (bool, optional) – when True, use ceil instead of floor to compute the output shape. Default: False.

Return type:

Tensor