FractionalMaxPool3d — PyTorch 2.7 documentation (original) (raw)

class torch.nn.FractionalMaxPool3d(kernel_size, output_size=None, output_ratio=None, return_indices=False, _random_samples=None)[source][source]

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

Fractional MaxPooling is described in detail in the paper Fractional MaxPooling by Ben Graham

The max-pooling operation is applied in kT×kH×kWkT \times kH \times kW regions by a stochastic step size determined by the target output size. The number of output features is equal to the number of input planes.

Note

Exactly one of output_size or output_ratio must be defined.

Parameters

Shape:

Examples

pool of cubic window of size=3, and target output size 13x12x11

m = nn.FractionalMaxPool3d(3, output_size=(13, 12, 11))

pool of cubic window and target output size being half of input size

m = nn.FractionalMaxPool3d(3, output_ratio=(0.5, 0.5, 0.5)) input = torch.randn(20, 16, 50, 32, 16) output = m(input)