conv3d(input: Tensor, weight: Tensor, bias: Tensor | None = None, stride: int | tuple[int, int, int] = 1, padding: str | int | tuple[int, int, int] = 0, dilation: int | tuple[int, int, int] = 1, groups: int = 1)Implementing kernel
C++ engine symbols that back this Python API.3-D cross-correlation over a 5-D (or unbatched 4-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
inputTensorInput of shape
(N, C_in, D, H, W), or (C_in, D, H, W)
unbatched.weightTensorFilters of shape
(C_out, C_in/groups, kD, kH, kW).Per-output-channel bias of shape
(C_out,).strideint or (int, int, int)= 1Step between adjacent kernel positions per axis (default
1).paddingint, (int, int, int), or {'valid', 'same'}= 0Zero padding on each spatial side; the strings read as in
conv2d.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)