fn
conv3d
→Tensorconv3d(x: Tensor, weight: Tensor, bias: Tensor | None = None, stride: int | tuple[int, int, int] = 1, padding: int | tuple[int, int, int] = 0, dilation: int | tuple[int, int, int] = 1, groups: int = 1)3-D cross-correlation over batched 5-D input.
Extends conv2d to volumetric data (depth × height × width).
Standard in medical imaging (CT, MRI), video understanding (I3D,
3D-ResNet, SlowFast) and any setting where the input has three
spatial axes. As with the 1-D and 2-D variants, this is technically
cross-correlation rather than strict convolution.
Parameters
xTensorInput of shape
(N, C_in, D, H, W).weightTensorFilters of shape
(C_out, C_in/groups, kD, kH, kW).biasTensor= NonePer-output-channel bias of shape
(C_out,).strideint or (int, int, int)= 1Step between adjacent kernel positions per axis (default
1).paddingint or (int, int, int)= 0Zero padding on each spatial side.
dilationint or (int, int, int)= 1Spacing between kernel taps (atrous convolution). Default
1.groupsint= 1Split channels into
groups independent groups.Returns
TensorOutput of shape (N, C_out, D_out, H_out, W_out) where each
spatial size obeys
(analogously for H and W).
Notes
Math:
3-D convolution has cubic kernel cost in k — for large kernels,
consider factorised variants (e.g. (1, k, k) followed by
(k, 1, 1)) which trade expressivity for compute.
Examples
>>> import lucid
>>> from lucid.nn.functional import conv3d
>>> x = lucid.randn(1, 1, 16, 32, 32)
>>> w = lucid.randn(4, 1, 3, 3, 3)
>>> y = conv3d(x, w, padding=1)
>>> y.shape
(1, 4, 16, 32, 32)