oneflow.nn.AdaptiveMaxPool3d

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

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

The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.nn.AdaptiveMaxPool3d.html.

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

Parameters
  • output_size – the target output size of the image of the form \(D_{out} \times H_{out} \times W_{out}\). Can be a tuple \((D_{out}, H_{out}, W_{out})\) or a single \(D_{out}\) for a cube \(D_{out} \times D_{out} \times D_{out}\). \(D_{out}\), \(H_{out}\) and \(W_{out}\) should be a int.

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

Shape:
  • Input: \((N, C, D_{in}, H_{in}, W_{in})\).

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

Examples:

>>> import oneflow as flow
>>> import oneflow.nn as nn
>>> # target output size of 5x7x9
>>> m = nn.AdaptiveMaxPool3d((5,7,9))
>>> input = flow.randn(1, 64, 8, 9, 10)
>>> output = m(input)
>>> print(output.shape)
oneflow.Size([1, 64, 5, 7, 9])
>>> # target output size of 7x7x7 (cube)
>>> m = nn.AdaptiveMaxPool3d(7)
>>> input = flow.randn(1, 64, 10, 9, 8)
>>> output = m(input)
>>> print(output.shape)
oneflow.Size([1, 64, 7, 7, 7])