tf.contrib.layers.conv2d_transpose(args, *kwargs)

tf.contrib.layers.conv2d_transpose(*args, **kwargs)

tf.contrib.layers.convolution2d_transpose(*args, **kwargs)

See the guide: Layers (contrib) > Higher level ops for building neural network layers

Adds a convolution2d_transpose with an optional batch normalization layer.

The function creates a variable called weights, representing the kernel, that is convolved with the input. If batch_norm_params is None, a second variable called 'biases' is added to the result of the operation.


  • inputs: A 4-D Tensor of type float and shape [batch, height, width, in_channels] for NHWC data format or [batch, in_channels, height, width] for NCHW data format.
  • num_outputs: integer, the number of output filters.
  • kernel_size: a list of length 2 holding the [kernel_height, kernel_width] of of the filters. Can be an int if both values are the same.
  • stride: a list of length 2: [stride_height, stride_width]. Can be an int if both strides are the same. Note that presently both strides must have the same value.
  • padding: one of 'VALID' or 'SAME'.
  • data_format: A string. NHWC (default) and NCHW are supported.
  • activation_fn: activation function, set to None to skip it and maintain a linear activation.
  • normalizer_fn: normalization function to use instead of biases. If normalizer_fn is provided then biases_initializer and biases_regularizer are ignored and biases are not created nor added. default set to None for no normalizer function
  • normalizer_params: normalization function parameters.
  • weights_initializer: An initializer for the weights.
  • weights_regularizer: Optional regularizer for the weights.
  • biases_initializer: An initializer for the biases. If None skip biases.
  • biases_regularizer: Optional regularizer for the biases.
  • reuse: whether or not the layer and its variables should be reused. To be able to reuse the layer scope must be given.
  • variables_collections: optional list of collections for all the variables or a dictionary containing a different list of collection per variable.
  • outputs_collections: collection to add the outputs.
  • trainable: whether or not the variables should be trainable or not.
  • scope: Optional scope for variable_scope.


a tensor representing the output of the operation.


  • ValueError: if 'kernel_size' is not a list of length 2.
  • ValueError: if data_format is neither NHWC nor NCHW.
  • ValueError: if C dimension of inputs is None.

Defined in tensorflow/contrib/framework/python/ops/