Apply the 2d deconvolution.

  • If data_format is 'NCHW', excepts input shape \((N, C_{\text{in}}, H, W)\), weight shape \((C_{\text{in}}, C_{\text{out}}, H_{\text{k}}, W_{\text{k}})\), and output shape is \((N, C_{\text{out}}, H_{\text{out}}, W_{\text{out}})\).
  • If data_format is 'NHWC', excepts input shape \((N, H, W, C_{\text{in}})\), weight shape \((C_{\text{in}}, H_{\text{k}}, W_{\text{k}}, C_{\text{out}})\), and output shape is \((N, H_{\text{out}}, W_{\text{out}}, C_{\text{out}})\).
  • If padding is 'VALID', pads controls the explicit padding size. Otherwise, size are computed automatically use the given method.


x = dragon.ones((1, 2, 2, 2))
w = dragon.ones((3, 2, 1, 1))
y = dragon.nn.conv2d_transpose(
    [x, w],
    output_shape=(3, 3),
    output_padding=(1, 1))
assert y.shape == (1, 3, 3, 3)
  • inputs (Sequence[dragon.Tensor]) – The tensor x, weight and optional bias.
  • kernel_shape (Union[int, Sequence[int]], optional, default=3) – The shape of convolution window.
  • strides (Union[int, Sequence[int]], optional, default=1) – The stride of convolution window.
  • pads (Union[int, Sequence[int]], optional, default=0) – The zero padding size.
  • dilations (Union[int, Sequence[int]], optional, default=1) – The rate of dilated convolution.
  • group (int, optional, default=1) – The number of groups to split channels into.
  • padding (str, optional, default='VALID') – 'VALID', 'SAME', 'SAME_UPPER' or 'SAME_LOWER'.
  • output_padding (Union[Sequence[int], dragon.Tensor], optional) – The additional size added to the output shape.
  • output_shape (Union[Sequence[int], dragon.Tensor], optional) – The output shape for automatic padding.
  • data_format (str, optional, default='NCHW') – 'NCHW' or 'NHWC'.

dragon.Tensor – The output tensor.