class oneflow.nn.AdaptiveMaxPool1d(output_size, return_indices: bool = False)

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

The documentation is referenced from:

The output size is \(L_{out}\), for any input size. The number of output features is equal to the number of input planes.

  • output_size – the target output size \(L_{out}\).

  • return_indices – if True, will return the indices along with the outputs. Default: False

  • Input: \((N, C, L_{in})\).

  • Output: \((N, C, L_{out})\), where \(L_{out}=\text{output_size}\).


>>> import oneflow as flow
>>> # target output size of 5
>>> m = flow.nn.AdaptiveMaxPool1d(5)
>>> input = flow.randn(1, 64, 8)
>>> output = m(input)
>>> print(output.shape)
oneflow.Size([1, 64, 5])