fn
max_pool3d
→Tensormax_pool3d(x: Tensor, kernel_size: int | tuple[int, int, int], stride: int | tuple[int, int, int] | None = None, padding: int | tuple[int, int, int] = 0, dilation: int | tuple[int, int, int] = 1, return_indices: bool = False, ceil_mode: bool = False)3-D max pooling over a sliding window.
Volumetric downsampling primitive — extends max_pool2d by
one depth dimension. Used in 3-D CNNs for medical imaging and
video understanding.
Parameters
xTensorInput of shape
(N, C, D, H, W).kernel_sizeint or (int, int, int)Size of the pooling window per axis.
strideint or (int, int, int)= NoneWindow step. Defaults to
kernel_size.paddingint or (int, int, int)= 0Implicit zero-padding on each spatial side.
dilationint or (int, int, int)= 1Spacing between window elements. Default
1.return_indicesbool= FalseMust currently be
False.ceil_modebool= FalseUse ceil instead of floor in the output-size formula.
Returns
TensorOutput of shape (N, C, D_out, H_out, W_out) where each
spatial dim obeys
Notes
Math:
Memory cost can become significant for large volumes — when the
network only needs a global summary, prefer
adaptive_max_pool3d with output_size=(1, 1, 1).
Examples
>>> import lucid
>>> from lucid.nn.functional import max_pool3d
>>> x = lucid.randn(1, 4, 8, 16, 16)
>>> y = max_pool3d(x, kernel_size=2)
>>> y.shape
(1, 4, 4, 8, 8)