parameters: (
      inputs,
      num_outputs,
      kernel_size,
      stride=1,
      padding='SAME',
      activation_fn=nn.relu,
      normalizer_fn=None,
      normalizer_params=None,
      weights_initializer=initializers.xavier_initializer(),
      weights_regularizer=None,
      biases_initializer=init_ops.zeros_initializer,
      biases_regularizer=None,
      reuse=None,
      variables_collections=None,
      outputs_collections=None,
      trainable=True,
      scope=None)
docstring: 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.
  
    Args:
      inputs: a tensor of size [batch_size, height, width, channels].
      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'.
      activation_fn: activation function.
      normalizer_fn: normalization function to use instead of `biases`. If
        `normalize_fn` is provided then `biases_initializer` and
        `biases_regularizer` are ignored and `biases` are not created nor added.
      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 dictionay 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_op_scope.
  
    Returns:
      a tensor representing the output of the operation.
  
    Raises:
      ValueError: if 'kernel_size' is not a list of length 2.
docstring_summary: Adds a convolution2d_transpose with an optional batch normalization layer.
docstring_tokens: Adds a convolution2d_transpose with an optional batch normalization layer .
function: def convolution2d_transpose(
      inputs,
      num_outputs,
      kernel_size,
      stride=1,
      padding='SAME',
      activation_fn=nn.relu,
      normalizer_fn=None,
      normalizer_params=None,
      weights_initializer=initializers.xavier_initializer(),
      weights_regularizer=None,
      biases_initializer=init_ops.zeros_initializer,
      biases_regularizer=None,
      reuse=None,
      variables_collections=None,
      outputs_collections=None,
      trainable=True,
      scope=None):
    """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.
  
    Args:
      inputs: a tensor of size [batch_size, height, width, channels].
      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'.
      activation_fn: activation function.
      normalizer_fn: normalization function to use instead of `biases`. If
        `normalize_fn` is provided then `biases_initializer` and
        `biases_regularizer` are ignored and `biases` are not created nor added.
      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 dictionay 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_op_scope.
  
    Returns:
      a tensor representing the output of the operation.
  
    Raises:
      ValueError: if 'kernel_size' is not a list of length 2.
    """
    with variable_scope.variable_op_scope(
        [inputs], scope, 'Conv2d_transpose', reuse=reuse) as sc:
      dtype = inputs.dtype.base_dtype
      kernel_h, kernel_w = utils.two_element_tuple(kernel_size)
      stride_h, stride_w = utils.two_element_tuple(stride)
      num_filters_in = utils.last_dimension(
          inputs.get_shape(), min_rank=4)
      weights_shape = [kernel_h, kernel_w, num_outputs, num_filters_in]
      weights_collections = utils.get_variable_collections(
          variables_collections, 'weights')
      weights = variables.model_variable(
          'weights',
          shape=weights_shape,
          dtype=dtype,
          initializer=weights_initializer,
          regularizer=weights_regularizer,
          trainable=trainable,
          collections=weights_collections)
  
      inputs_shape = array_ops.shape(inputs)
      batch_size = inputs_shape[0]
      height, width = inputs_shape[1], inputs_shape[2]
  
      def get_deconv_dim(dim_size, stride_size, kernel_size, padding):
        if isinstance(dim_size, ops.Tensor):
          dim_size = math_ops.mul(dim_size, stride_size)
        elif dim_size is not None:
          dim_size *= stride_size
  
        if padding == 'VALID' and dim_size is not None:
          dim_size += max(kernel_size - stride_size, 0)
        return dim_size
  
      # Infer the dynamic output shape:
      out_height = get_deconv_dim(height, stride_h, kernel_h, padding)
      out_width = get_deconv_dim(width, stride_w, kernel_w, padding)
  
      output_shape = array_ops.pack(
          [batch_size, out_height, out_width, num_outputs])
      outputs = nn.conv2d_transpose(inputs, weights, output_shape,
                                    [1, stride_h, stride_w, 1],
                                    padding=padding)
  
      # Infer the static output shape:
      out_shape = inputs.get_shape().as_list()
      out_shape[-1] = num_outputs
      out_shape[1] = get_deconv_dim(out_shape[1], stride_h, kernel_h, padding)
      out_shape[2] = get_deconv_dim(out_shape[2], stride_w, kernel_w, padding)
      outputs.set_shape(out_shape)
  
      if normalizer_fn:
        normalizer_params = normalizer_params or {}
        outputs = normalizer_fn(outputs, **normalizer_params)
      else:
        if biases_initializer is not None:
          biases_collections = utils.get_variable_collections(
              variables_collections, 'biases')
          biases = variables.model_variable('biases',
                                            shape=[num_outputs,],
                                            dtype=dtype,
                                            initializer=biases_initializer,
                                            regularizer=biases_regularizer,
                                            collections=biases_collections)
          outputs = nn.bias_add(outputs, biases)
  
      if activation_fn:
        outputs = activation_fn(outputs)
      return utils.collect_named_outputs(outputs_collections, sc.name, outputs)
function_tokens: def convolution2d_transpose ( inputs , num_outputs , kernel_size , stride = 1 , padding = 'SAME' , activation_fn = nn . relu , normalizer_fn = None , normalizer_params = None , weights_initializer = initializers . xavier_initializer ( ) , weights_regularizer = None , biases_initializer = init_ops . zeros_initializer , biases_regularizer = None , reuse = None , variables_collections = None , outputs_collections = None , trainable = True , scope = None ) : with variable_scope . variable_op_scope ( [ inputs ] , scope , 'Conv2d_transpose' , reuse = reuse ) as sc : dtype = inputs . dtype . base_dtype kernel_h , kernel_w = utils . two_element_tuple ( kernel_size ) stride_h , stride_w = utils . two_element_tuple ( stride ) num_filters_in = utils . last_dimension ( inputs . get_shape ( ) , min_rank = 4 ) weights_shape = [ kernel_h , kernel_w , num_outputs , num_filters_in ] weights_collections = utils . get_variable_collections ( variables_collections , 'weights' ) weights = variables . model_variable ( 'weights' , shape = weights_shape , dtype = dtype , initializer = weights_initializer , regularizer = weights_regularizer , trainable = trainable , collections = weights_collections ) inputs_shape = array_ops . shape ( inputs ) batch_size = inputs_shape [ 0 ] height , width = inputs_shape [ 1 ] , inputs_shape [ 2 ] def get_deconv_dim ( dim_size , stride_size , kernel_size , padding ) : if isinstance ( dim_size , ops . Tensor ) : dim_size = math_ops . mul ( dim_size , stride_size ) elif dim_size is not None : dim_size *= stride_size if padding == 'VALID' and dim_size is not None : dim_size += max ( kernel_size - stride_size , 0 ) return dim_size # Infer the dynamic output shape: out_height = get_deconv_dim ( height , stride_h , kernel_h , padding ) out_width = get_deconv_dim ( width , stride_w , kernel_w , padding ) output_shape = array_ops . pack ( [ batch_size , out_height , out_width , num_outputs ] ) outputs = nn . conv2d_transpose ( inputs , weights , output_shape , [ 1 , stride_h , stride_w , 1 ] , padding = padding ) # Infer the static output shape: out_shape = inputs . get_shape ( ) . as_list ( ) out_shape [ - 1 ] = num_outputs out_shape [ 1 ] = get_deconv_dim ( out_shape [ 1 ] , stride_h , kernel_h , padding ) out_shape [ 2 ] = get_deconv_dim ( out_shape [ 2 ] , stride_w , kernel_w , padding ) outputs . set_shape ( out_shape ) if normalizer_fn : normalizer_params = normalizer_params or { } outputs = normalizer_fn ( outputs , * * normalizer_params ) else : if biases_initializer is not None : biases_collections = utils . get_variable_collections ( variables_collections , 'biases' ) biases = variables . model_variable ( 'biases' , shape = [ num_outputs , ] , dtype = dtype , initializer = biases_initializer , regularizer = biases_regularizer , collections = biases_collections ) outputs = nn . bias_add ( outputs , biases ) if activation_fn : outputs = activation_fn ( outputs ) return utils . collect_named_outputs ( outputs_collections , sc . name , outputs )