espnet2.enh.layers.conv_utils.convtransp2d_output_shape
espnet2.enh.layers.conv_utils.convtransp2d_output_shape
espnet2.enh.layers.conv_utils.convtransp2d_output_shape(h_w, kernel_size=1, stride=1, pad=0, dilation=1, out_pad=0)
Calculate the output shape of a 2D transposed convolution layer.
This function computes the height and width of the output tensor resulting from a 2D transposed convolution operation, given the input shape and various parameters such as kernel size, stride, padding, dilation, and output padding.
espnet2.enh.layers.conv_utils.h_w
The height and width of the input tensor (H, W).
- Type: tuple
espnet2.enh.layers.conv_utils.kernel_size
The size of the convolution kernel (KH, KW).
- Type: tuple or int
espnet2.enh.layers.conv_utils.stride
The stride of the convolution (SH, SW).
- Type: tuple or int
espnet2.enh.layers.conv_utils.pad
The padding added to the input (PH, PW).
- Type: tuple or int
espnet2.enh.layers.conv_utils.dilation
The dilation rate for the kernel (DH, DW).
- Type: tuple or int
espnet2.enh.layers.conv_utils.out_pad
The additional output padding (OH, OW).
Type: tuple or int
Parameters:
- h_w (tuple or int) – The input height and width.
- kernel_size (tuple or int , optional) – The size of the convolution kernel. Default is 1.
- stride (tuple or int , optional) – The stride of the convolution. Default is 1.
- pad (tuple or int , optional) – The padding added to the input. Default is 0.
- dilation (tuple or int , optional) – The dilation rate for the kernel. Default is 1.
- out_pad (tuple or int , optional) – The additional output padding. Default is 0.
Returns: The computed output height and width (H_out, W_out).
Return type: tuple
Examples
>>> convtransp2d_output_shape((5, 5), kernel_size=3, stride=2, pad=1)
(11, 11)
>>> convtransp2d_output_shape((10, 10), kernel_size=(3, 3), stride=(2, 2),
... pad=(1, 1), dilation=(1, 1), out_pad=(1, 1))
(22, 22)
NOTE
The input height and width should be positive integers, and the kernel size, stride, padding, dilation, and output padding should be positive integers or tuples of two positive integers.