code: def transformer_image_decoder(targets,
                                encoder_output,
                                ed_attention_bias,
                                hparams,
                                name=None):
    
    with tf.variable_scope(name, default_name="transformer_dec"):
      batch_size = common_layers.shape_list(targets)[0]
      targets = tf.reshape(targets, [batch_size,
                                     hparams.img_len,
                                     hparams.img_len,
                                     hparams.num_channels * hparams.hidden_size])
      decoder_input, _, _ = cia.prepare_decoder(targets, hparams)
      decoder_output = cia.transformer_decoder_layers(
          decoder_input,
          encoder_output,
          hparams.num_decoder_layers or hparams.num_hidden_layers,
          hparams,
          attention_type=hparams.dec_attention_type,
          encoder_decoder_attention_bias=ed_attention_bias,
          name="decoder")
      decoder_output = tf.reshape(decoder_output,
                                  [batch_size,
                                   hparams.img_len,
                                   hparams.img_len * hparams.num_channels,
                                   hparams.hidden_size])
      return decoder_output
docs: Transformer image decoder over targets with local attention.
  
    Args:
      targets: Tensor of shape [batch, ...], and whose size is batch * height *
        width * hparams.num_channels * hparams.hidden_size.
      encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size].
      ed_attention_bias: Tensor which broadcasts with shape [batch,
        hparams.num_heads, length_q, length_kv]. Encoder-decoder attention bias.
      hparams: HParams.
      name: string, variable scope.
  
    Returns:
      Tensor of shape [batch, height, width * hparams.num_channels,
      hparams.hidden_size].