fn
adaptive_avg_pool3d
→Tensoradaptive_avg_pool3d(x: Tensor, output_size: int | tuple[int, int, int])3-D adaptive average pooling — produces a fixed (D, H, W).
Volumetric counterpart of adaptive_avg_pool2d. Used by
3-D classification heads to collapse a volumetric feature map to
a fixed embedding shape regardless of input size.
Parameters
xTensorInput of shape
(N, C, D, H, W).output_sizeint or (int, int, int)Desired output spatial shape.
Returns
TensorOutput of shape (N, C, oD, oH, oW).
Notes
Per-cell window definitions follow the same floor / ceil construction used in the 2-D variant. The cell value is the mean over the volumetric window:
When the input dims divide output_size evenly the engine path
is taken; otherwise a per-slot Python fallback runs (all data
stays on-device).
Examples
>>> import lucid
>>> from lucid.nn.functional import adaptive_avg_pool3d
>>> x = lucid.randn(1, 16, 8, 10, 10)
>>> y = adaptive_avg_pool3d(x, output_size=(2, 2, 2))
>>> y.shape
(1, 16, 2, 2, 2)