ConvTranspose
Description
- Performs a transposed convolution operation using an input tensor and a filter to generate the output tensor.
- If the pads parameter is provided, the output shape is calculated as follows:

- output_shape can also be explicitly specified. In this case, pads are automatically generated using the following formula:
Input
- X: input tensor from the upper layer. For 2D convolution, the shape is [N, C, H, W], where N indicates the batch size, C indicates the number of channels, H and W indicate the height and width. For more than two dimensions, the shape is [N, C, D, H, W] and the data type is float16.
- W: weight tensor. For 2D convolution, the shape is [C, M/group, kH, kW], where C indicates the number of channels, kH and kW indicate the height and width of the kernel, and M indicates the number of feature maps. For more than two dimensions, the weight shape is [C, M/group, kD, kH, kW]. The number of channels in the output must be equal to W.shape[1] * group (assuming that the index of the shape array starts from 0). The data type can be float16.
- B (optional): 1D tensor of type float16, with shape [M].
Attribute
- auto_pad: string. The value can be NOTSET, SAME_UPPER, SAME_LOWER, or VALID. The default value is NOTSET, indicating that padding is explicitly used. SAME_UPPER or SAME_LOWER indicates that the input is padded. The shape of the output y is y_H = x_H * stride_H, y_W = x_W * stride_W. When auto_pad is set to VALID, padding is not used.
- dilations: a sequence of integers (defaulting to all ones) that represents the dilation rate for each axis of the filter.
- group: The data type is int. The default value is 1, indicating the number of input channel groups.
- kernel_shape: The data type is ints. The shape of the filter needs to be input, indicating the size of the convolution kernel. The two-dimensional convolution input is [k H, k W], and the three-dimensional convolution input is [k D, k H, k W].
- output_padding: A sequence of integers (defaulting to an all-zero array) that specifies the additional padding applied to the output. For a 4D input tensor, it is a list of 4 integers; for a 5D input tensor, it is a list of 5 integers.
- output_shape: The data type is ints. The output shape is automatically calculated based on pad.
- pads: The data type is ints. The default value is an all-0 matrix, indicating the padding value specified for each axis.
- strides: The data type is ints. The default value is an all-1 matrix, indicating the stride value of each axis.
Output
y: output tensor of the convolution result. The data type is the same as that of the input.
Constraints
- The number of input channels [C] must be divisible by group. Constraints must be satisfied for the bias shape [M], the first dimension of the filter [M/group], and the first dimension of the output y [M].
- The auto_pad attribute supports SAME_UPPER, SAME_LOWER, and VALID in 2D scenarios, but does not support them in 3D scenarios.
- When the auto_pad attribute is set to SAME_UPPER, SAME_LOWER, or VALID in 2D scenarios, the pads attribute will be corrected if it is provided.
ONNX Opset Support
Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18
Parent topic: Supported ONNX Operators


