code: def create_output(decoder_output, rows, cols, targets, hparams):
      """Creates output from decoder output and vars.
  
      Args:
        decoder_output: Tensor of shape [batch, ...], where ... can be any rank such
          that the number of elements is batch * rows * cols * hparams.hidden_size.
        rows: Integer representing number of rows in a 2-D data point.
        cols: Integer representing number of columns in a 2-D data point.
        targets: Tensor of shape [batch, hparams.img_len, hparams.img_len,
          hparams.num_channels].
        hparams: HParams set.
  
      Returns:
        Tensor of shape [batch, hparams.img_len, hparams.img_len,
        hparams.num_mixtures * 10] if hparams.likelihood is DMOL, otherwise
        [batch, hparams.img_len, hparams.img_len, hparams.num_channels, 256].
        In the special case of predict mode, it is a Tensor of rank 5.
      """
      del targets  # unused arg
      decoded_image = postprocess_image(
          decoder_output, rows, cols, hparams
      )
      batch = common_layers.shape_list(decoded_image)[0]
      depth = common_layers.shape_list(decoded_image)[-1]
      likelihood = getattr(hparams, "likelihood", DistributionType.CAT)
      if hparams.mode == tf_estimator.ModeKeys.PREDICT:
          y = tf.reshape(decoded_image, [batch, -1, 1, 1, depth])
          output = y[:, :rows, :, :, :]
      elif likelihood == DistributionType.CAT:
          # Unpack the cols dimension of the Categorical.
          channels = hparams.num_channels
          output = tf.reshape(
              decoded_image,
              [batch, rows, cols // channels, channels, depth],
          )
      else:
          output = decoded_image
      return output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from six.moves import range
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.utils import expert_utils
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 18 for calling a global function with example usage: create_output(decoder_output, rows, cols, targets, hparams) and returns: output