Shortcuts

AdaptiveAvgPool1d

class torch.nn.AdaptiveAvgPool1d(output_size)[source][source]

Applies a 1D adaptive average pooling over an input signal composed of several input planes.

The output size is LoutL_{out}, for any input size. The number of output features is equal to the number of input planes.

Parameters

output_size (Union[int, Tuple[int]]) – the target output size LoutL_{out}.

Shape:
  • Input: (N,C,Lin)(N, C, L_{in}) or (C,Lin)(C, L_{in}).

  • Output: (N,C,Lout)(N, C, L_{out}) or (C,Lout)(C, L_{out}), where Lout=output_sizeL_{out}=\text{output\_size}.

Examples

>>> # target output size of 5
>>> m = nn.AdaptiveAvgPool1d(5)
>>> input = torch.randn(1, 64, 8)
>>> output = m(input)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources