class

ZeroPad3d

extendsConstantPad3d
ZeroPad3d(padding: int | tuple[int, int, int, int, int, int])
source

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.
valuefloat
Always 0.0.

Notes

  • Input: (N,C,D,H,W)(N, C, D, H, W).
  • Output: (N,C,Dout,Hout,Wout)(N, C, D_{\text{out}}, H_{\text{out}}, W_{\text{out}}).

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)

Methods (2)

dunder

__init__

None
__init__(padding: int | tuple[int, int, int, int, int, int])
source

Initialise the ZeroPad3d module. See the class docstring for parameter semantics.

fn

extra_repr

str
extra_repr()
source

Return a string representation of the layer's configuration.