class
ZeroPad3d
extends
ConstantPad3dZeroPad3d(padding: int | tuple[int, int, int, int, int, int])Pad a 5-D tensor (N, C, D, H, W) with zeros on all six faces.
Equivalent to ConstantPad3d(padding, value=0.0). Used before 3-D
convolutions operating on volumetric data (medical imaging, video, point
clouds) to maintain spatial dimensions.
Parameters
paddingint or tuple[int, int, int, int, int, int](left, right, top, bottom, front, back) padding sizes. A single
int pads equally on all six faces.Attributes
paddingtuple[int, int, int, int, int, int]Normalised 6-element padding tuple.
valuefloatAlways
0.0.Notes
- Input: .
- Output: .
Examples
**Same-padding for a 3×3×3 volumetric convolution:**
>>> import lucid
>>> import lucid.nn as nn
>>>
>>> pad = nn.ZeroPad3d(1) # 1 voxel on every face
>>> x = lucid.zeros(1, 8, 16, 16, 16)
>>> pad(x).shape
(1, 8, 18, 18, 18)
**Temporal-only padding for video (depth = time axis):**
>>> pad = nn.ZeroPad3d(padding=(0, 0, 0, 0, 1, 1))
>>> x = lucid.zeros(2, 3, 8, 112, 112)
>>> pad(x).shape
(2, 3, 10, 112, 112)