code: def nas_decoder(
      decoder_input,
      encoder_cell_outputs,
      decoder_self_attention_bias,
      encoder_decoder_attention_bias,
      hparams,
      final_layer_norm=True,
  ):
      """Decoder for configurable model.
  
      Args:
        decoder_input: Input tensor.
        encoder_cell_outputs: List of tensors. The encoder cell outputs, listed in
          order.
        decoder_self_attention_bias: Attention bias that the decoder uses when
          attending to itself. This should have 0s for all valid positions and large
          negative numbers for all hidden future positions.
        encoder_decoder_attention_bias: Attention bias that the decoder uses when
          attending to the encoder. This should be 0s at all valid positions and
          large negative numbers for all padded positions.
        hparams: transformer.Transformer hparams that must also contain:
          + decoder_<left|right>_inputs: List of ints specifying the hidden layer
            input indexes for the <left|right> branches.
          + decoder_<left|right>_layers: String list of layers. Each string must be
            the name of a TranslationLayer registered in layers.py's DECODER_LAYERS.
          + decoder_<left|right>_activations: String list of activations. Each
            string in this list must have a corresponding activation in
            ACTIVATION_MAP.
          + decoder_<left|right>_output_dims: Int list of output dimensions for
            <left|right> branch layers.
          + decoder_<left|right>_norms: String list of norms to apply to the
            <left|right> layer branches. Each item must be either LAYER_NORM_KEY or
            NO_NORM_KEY.
          + decoder_num_cells: The number of cells in the decoder. This determines
            how many times the given layers will be repeated.
          + decoder_combiner_functions: String list of functions used to combine
            left and right branches. Must be a COMBINER_FUNCTION key.
          hparams may also optionally contain:
          + enforce_output_size: Boolean that determines whether or not the decoder
            output must be resized to hparams.hidden_size. If True, the output will
            be resized if it not equal to hparams.hidden_size. If False, the output
            will not be resized. If this field is not set, behavior defaults to
            True.
        final_layer_norm: Whether or not to apply a final layer norm to the output
          of the decoder.
  
      Returns:
        Decoder output tensor.
      """
      # Enforce that the output tensor depth is equal to the depth of the encoding.
      (_, output_depth, _, _) = calculate_branching_model_parameters(
          encoding_depth=hparams.hidden_size,
          left_inputs=hparams.decoder_left_inputs,
          left_layers=hparams.decoder_left_layers,
          left_output_dims=hparams.decoder_left_output_dims,
          right_inputs=hparams.decoder_right_inputs,
          right_layers=hparams.decoder_right_layers,
          right_output_dims=hparams.decoder_right_output_dims,
          combiner_functions=hparams.decoder_combiner_functions,
          final_combiner_function=hparams.decoder_final_combiner_function,
          layer_registry=layers.DECODER_LAYERS,
          num_cells=hparams.decoder_num_cells,
          encoder_depth=hparams.hidden_size,
      )
      improper_output_size = output_depth != hparams.hidden_size
  
      try:
          enforce_output_size = hparams.enforce_output_size
      except AttributeError:
          enforce_output_size = True
      resize_output = enforce_output_size and improper_output_size
  
      decoder_cells_output, _ = apply_nas_layers(
          input_tensor=decoder_input,
          left_inputs=hparams.decoder_left_inputs,
          left_layers=hparams.decoder_left_layers,
          left_activations=hparams.decoder_left_activations,
          left_output_dims=hparams.decoder_left_output_dims,
          left_norms=hparams.decoder_left_norms,
          right_inputs=hparams.decoder_right_inputs,
          right_layers=hparams.decoder_right_layers,
          right_activations=hparams.decoder_right_activations,
          right_output_dims=hparams.decoder_right_output_dims,
          right_norms=hparams.decoder_right_norms,
          num_cells=hparams.decoder_num_cells,
          combiner_functions=hparams.decoder_combiner_functions,
          final_combiner_function=hparams.decoder_final_combiner_function,
          nonpadding=None,
          layer_registry=layers.DECODER_LAYERS,
          mask_future=True,
          hparams=hparams,
          var_scope="decoder",
          decoder_self_attention_bias=decoder_self_attention_bias,
          encoder_decoder_attention_bias=encoder_decoder_attention_bias,
          encoder_cell_outputs=encoder_cell_outputs,
          final_layer_norm=final_layer_norm,
      )
  
      if not resize_output:
          return decoder_cells_output
  
      # Resize output if necessary.
      dense_layer = layers.DECODER_LAYERS.get(
          layers.STANDARD_CONV_1X1_REGISTRY_KEY
      )
      output = dense_layer.apply_layer(
          decoder_cells_output,
          None,
          hparams.hidden_size,
          None,
          hparams,
          "decoder_resize_dense",
          mask_future=True,
          layer_preprocess_fn=None,
          postprocess_dropout=True,
          nonpadding=None,
          attention_dropout_broadcast_dims=None,
          encoder_decoder_attention_bias=None,
          encoder_cell_outputs=None,
          decoder_self_attention_bias=None,
      )
      if final_layer_norm:
          output = common_layers.layer_preprocess(output, hparams)
  
      return output
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import six
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.models.neural_architecture_search import nas_layers
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import metrics
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
label_desc: Use image node_id 8 for calling a global function with example usage: nas_decoder(decoder_input, encoder_cell_outputs, decoder__attention_bias, encoder_decoder_attention_bias, hparams, final_layer_norm) and returns: output, decoder_cells_output