code: def decoder(
      name, latents, hparams, decoder_self_attention_bias, **kwargs
  ):
      """Compute final hidden states for p(y|z,x)."""
      with tf.variable_scope(name, reuse=tf.AUTO_REUSE):
          decoder_input = drop_2d(
              latents, hparams.mode, hparams.decoder_2d_dropout
          )
          if hparams.pos_attn:
              decoder_input = gops.positional_attention(
                  "pos_attn",
                  decoder_input,
                  decoder_self_attention_bias,
                  hparams,
              )
          else:
              decoder_input = common_attention.add_timing_signal_1d(
                  decoder_input
              )
          if (
              common_layers.shape_list(latents)[-1]
              != hparams.hidden_size
          ):
              decoder_input = gops.dense(
                  "lat2hid", latents, hparams.hidden_size
              )
          decoder_output = transformer_decoder_layers(
              "block",
              n_layers=hparams.n_decoder_layers,
              decoder_input=decoder_input,
              hparams=hparams,
              decoder_self_attention_bias=decoder_self_attention_bias,
              **kwargs,
          )
          batch_size, targets_length = common_layers.shape_list(
              decoder_output
          )[:2]
          decoder_output = tf.reshape(
              decoder_output,
              [batch_size, targets_length, 1, hparams.hidden_size],
          )
          # Expand since t2t expects 4d tensors.
          return decoder_output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from six.moves import range
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers import transformer_glow_layers_ops
  from tensor2tensor.models.transformer import transformer_decoder_layer
  from tensor2tensor.models.transformer import transformer_encoder
  from tensor2tensor.models.transformer import transformer_prepare_encoder
  from tensor2tensor.utils import learning_rate
  from tensor2tensor.utils import mlperf_log
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 6 for calling a global function with example usage: decoder(name, latents, hparams, decoder__attention_bias) and returns: decoder_output