class
LPPool3d
extends
ModuleLPPool3d(norm_type: float, kernel_size: int | tuple[int, int, int], stride: int | tuple[int, int, int] | None = None, ceil_mode: bool = False)Applies 3-D power-average (Lp-norm) pooling over a volumetric input.
Extends LPPool2d to three spatial dimensions. For each
window:
Parameters
norm_typefloatThe exponent . Must be positive and finite.
kernel_sizeint or tuple[int, int, int]Window size
(k_D, k_H, k_W). A scalar is broadcast.strideint or tuple[int, int, int] or None= NoneStep between windows. Defaults to
kernel_size.ceil_modebool= FalseUse ceiling for output sizes. Default:
False.Attributes
norm_typefloatkernel_sizeint or tuple[int, int, int]strideint or tuple[int, int, int]ceil_modeboolNotes
- Input:
(N, C, D_in, H_in, W_in) - Output:
(N, C, D_out, H_out, W_out)
- Thin wrapper around
lucid.nn.functional.pooling.lp_pool3d, providing the standardModuleinterface. - Special cases follow those of
LPPool1dandLPPool2d— the exponent smoothly interpolates between sum (), energy (), and max pooling.
Examples
L2 energy pooling over a volumetric map:
>>> import lucid
>>> import lucid.nn as nn
>>> pool = nn.LPPool3d(norm_type=2, kernel_size=2, stride=2)
>>> x = lucid.ones((1, 16, 8, 8, 8))
>>> y = pool(x)
>>> y.shape
(1, 16, 4, 4, 4)
Non-overlapping sum pooling (p=1):
>>> pool = nn.LPPool3d(norm_type=1, kernel_size=(1, 2, 2))
>>> x = lucid.ones((2, 32, 4, 16, 16))
>>> y = pool(x)
>>> y.shape
(2, 32, 4, 8, 8)Methods (3)
dunder
__init__
→None__init__(norm_type: float, kernel_size: int | tuple[int, int, int], stride: int | tuple[int, int, int] | None = None, ceil_mode: bool = False)Initialise the LPPool3d module. See the class docstring for parameter semantics.
fn
forward
→Tensorforward(x: Tensor)Apply the pooling operation to the input tensor.
Parameters
inputTensorInput tensor of shape where are the
spatial dimensions appropriate for this pooling layer.
Returns
TensorPooled output tensor.
fn
extra_repr
→strextra_repr()Return a string representation of the layer's configuration.