Skip to content
fn

conv_transpose2d_op

→TensorImplPtr
int conv_transpose2d_op(const int & x, const int & W, const int & b, int stride_h, int stride_w, int pad_h, int pad_w, int opad_h, int opad_w, int dilation_h, int dilation_w, int groups)

Python wrappers

Public Python APIs implemented by this engine symbol.

Two-dimensional transposed convolution (fractionally-strided conv).

The 2-D upsampling primitive used by VAE / GAN decoders, U-Net expansion paths, and super-resolution heads. Equivalent to the gradient of a 2-D convolution w.r.t. its input.

Parameters

xTensorImplPtr
Input of shape (B, C_in, H, W).
WTensorImplPtr
Filters of shape (C_in, C_out / groups, KH, KW).
bTensorImplPtr
Bias of shape (C_out,) or empty.
stride_h, stride_wint= None
Per-axis upsampling factor. Default: 1.
pad_h, pad_wint= None
Per-axis padding subtracted from the output extent. Default: 0.
opad_h, opad_wint= None
Per-axis one-sided output padding. Default: 0.

Returns

TensorImplPtr

Output of shape (B, C_out, H_out, W_out) with Hout=(H−1)sh−2ph+KH+phoutH_\text{out} = (H - 1) s_h - 2 p_h + KH + p^\text{out}_h and analogously for WoutW_\text{out}.

Notes

When stride > 1 and kernel_size is not divisible by stride the output can exhibit characteristic checkerboard artefacts. A common mitigation is to choose kernel_size = stride * n or to substitute bilinear upsampling followed by a regular convolution. dilation_h, dilation_w : int, optional Per-axis spacing between kernel taps. Default: 1. groups : int, optional Channel grouping factor. Default: 1.