LazyConvTranspose3d
_LazyConvMixinConvTranspose3dLazyConvTranspose3d(out_channels: int, kernel_size: _Size3d, stride: _Size3d = 1, padding: _Size3d = 0, output_padding: _Size3d = 0, groups: int = 1, bias: bool = True, dilation: _Size3d = 1, padding_mode: str = 'zeros', device: DeviceLike = None, dtype: DTypeLike = None)A ConvTranspose3d that infers in_channels from the first input.
Lazy version of the 3D transposed convolution. Combines volumetric upsampling with deferred weight allocation, simplifying the construction of 3D generative decoders and medical image synthesis networks where channel dimensions are computed dynamically.
Parameters
out_ channelsintkernel_ sizeint or tuple[int, int, int]strideint or tuple[int, int, int]= 11.paddingint or tuple[int, int, int]= 0dilation * (kernel_size - 1) - padding zero-padding applied
on each side of each spatial axis. String padding is not
supported. Default: 0.output_ paddingint or tuple[int, int, int]= 00.groupsint= 11.biasbool= TrueTrue, a learnable bias is added after materialization.
Default: True.dilationint or tuple[int, int, int]= 11.padding_ modestr= 'zeros'"zeros", the only mode; another raises ValueError.deviceDeviceLike= NoneNone.dtypeDTypeLike= NoneNone.Attributes
Notes
Input:
— is
inferred automatically.
Output:
—
same formula as ConvTranspose3d.
State-dict loading. A 5-D weight tensor triggers
materialization before parameter copying.
Symmetric 3D encoder–decoder. Pair each LazyConv3d
with a LazyConvTranspose3d using matching kernel_size,
stride, and padding for lossless spatial reconstruction.
Examples
Lazy 3D decoder block:
>>> import lucid
>>> import lucid.nn as nn
>>> up3d = nn.LazyConvTranspose3d(
... out_channels=32, kernel_size=4, stride=2, padding=1
... )
>>> x = lucid.zeros(2, 64, 4, 8, 8) # in_channels=64 inferred
>>> y = up3d(x)
>>> y.shape
(2, 32, 8, 16, 16)
Verify materialization:
>>> import lucid
>>> import lucid.nn as nn
>>> lazy = nn.LazyConvTranspose3d(out_channels=16, kernel_size=3, padding=1)
>>> print(lazy.in_channels)
None
>>> _ = lazy(lucid.zeros(1, 8, 4, 4, 4))
>>> print(lazy.in_channels)
8Used by 1
Constructors
1__init__
→None__init__(out_channels: int, kernel_size: _Size3d, stride: _Size3d = 1, padding: _Size3d = 0, output_padding: _Size3d = 0, groups: int = 1, bias: bool = True, dilation: _Size3d = 1, padding_mode: str = 'zeros', device: DeviceLike = None, dtype: DTypeLike = None)Initialise the LazyConvTranspose3d module. See the class docstring for parameter semantics.
Instance methods
4Return a string representation of the layer's configuration.
The eager layer's forward; the first call sizes in_channels from input.
initialize_parameters
→Nonefrom _LazyConvMixininitialize_parameters(input: Tensor, args: object = (), kwargs: object = {})Size in_channels from input and allocate the weights, if not sized yet.
Takes the extra positional and keyword arguments the reference's lazy convolutions accept, and ignores them, as it does.
Parameters
inputTensor*argsobject= ()**kwargsobject= ()Re-draw the values; nothing to do until the layer has been sized.