fn

conv_transpose1d

Tensor
conv_transpose1d(x: Tensor, weight: Tensor, bias: Tensor | None = None, stride: int | tuple[int, ...] = 1, padding: int | tuple[int, ...] = 0, output_padding: int | tuple[int, ...] = 0, groups: int = 1, dilation: int | tuple[int, ...] = 1)
source

Transposed 1-D convolution (a.k.a. "fractionally-strided" conv).

Often called "deconvolution" in the literature, but this is not the mathematical inverse of conv1d — it is the gradient operator of a forward convolution, used to map a low-resolution feature map back to a higher-resolution one. The standard upsampling primitive in 1-D decoder networks (autoencoders, TTS vocoders, etc.).

Parameters

xTensor
Input of shape (N, C_in, L_in).
weightTensor
Filters of shape (C_in, C_out/groups, kL).
biasTensor= None
Per-output-channel bias of shape (C_out,). When None, a zero bias is materialised internally (the engine op requires an explicit bias tensor).
strideint or tuple of int= 1
Upsampling factor between input cells (default 1).
paddingint or tuple of int= 0
Symmetric zero-padding shaved from each side of the output.
output_paddingint or tuple of int= 0
Extra one-sided trailing padding added to the output. Used to disambiguate the output size when stride > 1.
groupsint= 1
Channel grouping (currently 1-only in the engine path).
dilationint or tuple of int= 1
Spacing between kernel taps.

Returns

Tensor

Output of shape (N, C_out, L_out) where

Lout=(Lin1)s2p+d(k1)+op+1L_{\text{out}} = (L_{\text{in}} - 1) \cdot s - 2 p + d (k - 1) + \text{op} + 1

Notes

Conceptually, transposed convolution inserts stride - 1 zeros between consecutive input samples and then runs a normal convolution — hence the "fractional stride" name. In practice the engine implements it as the matrix-transpose of the corresponding forward conv, which avoids materialising the zero-stuffed buffer.

Checkerboard artifacts (regular high-frequency patterns) commonly arise when kernel_size is not divisible by stride; an alternative is conv1d after upsampling.

Examples

>>> import lucid
>>> from lucid.nn.functional import conv_transpose1d
>>> x = lucid.randn(1, 4, 10)
>>> w = lucid.randn(4, 2, 3)     # (C_in, C_out, kL)
>>> y = conv_transpose1d(x, w, stride=2)
>>> y.shape
(1, 2, 21)