conv_transpose

dragon.vm.tensorflow.nn.conv_transpose(
  input,
  filters,
  output_shape=None,
  strides=1,
  padding='SAME',
  output_padding=None,
  data_format='NHWC',
  dilations=1,
  name=None
)[source]

Apply the n-dimension deconvolution.

  • If data_format is 'NCHW', excepts input shape \((N, C_{\text{in}}, D1, D2, ...)\), filters shape \((C_{\text{in}}, C_{\text{out}}, D1_{\text{f}}, D2_{\text{f}}, ...)\), and output shape is \((N, C_{\text{out}}, D1_{\text{out}}, D2_{\text{out}}, ...)\).
  • If data_format is 'NHWC', excepts input shape \((N, D1, D2, ..., C_{\text{in}})\), filters shape \((C_{\text{in}}, D1_{\text{f}}, D2_{\text{f}}, ..., C_{\text{out}})\), and output shape is \((N, D1_{\text{out}}, D2_{\text{out}}, ..., C_{\text{out}})\).
  • padding could be 'VALID', 'SAME' or explicit padding size.

Examples:

for i in range(3):
    ndim = i + 1
    x = tf.ones((1,) + (2,) * ndim + (2,))
    filters = tf.ones((3,) + (1,) * ndim + (2,))
    y = tf.nn.conv_transpose(x, filters, output_shape=(2,) * ndim)
    assert y.shape == (1,) + (2,) * ndim + (3,)
Parameters:
  • input (dragon.Tensor) – The input tensor.
  • filters (dragon.Tensor) – The filters tensor.
  • output_shape (Union[Sequence[int], dragon.Tensor], optional) – The optional output shape.
  • strides (Union[int, Sequence[int]], default=1) – The stride of convolution window.
  • padding (Union[int, Sequence[int], str], optional) – The padding algorithm or size.
  • output_padding (Union[Sequence[int], dragon.Tensor], optional) – The additional size added to the output shape.
  • data_format (str, optional, default='NHWC') – 'NCHW' or 'NHWC'.
  • dilations (Union[int, Sequence[int]], optional, default=1) – The rate of dilated filters.
  • name (str, optional) – The operation name.
Returns:

dragon.Tensor – The output tensor.