class_docstr: Configurable seq2seq model used for Neural Architecture Search.
  
  Models are defined by 26 hparam fields. They are:
    - <encoder/decoder>_num_cells: The number of cells in the <encoder/decoder>.
    - <encoder/decoder>_<left/right>_layers: List of layers used the
                                             <encoder/decoder> <left/right>
                                             branch. For available layers, see
                                             the nas_layers.py file.
    - <encoder/decoder>_<left/right_inputs>: List of inputs to the
                                             <encoder/decoder> <left/right>
                                             layers. Each index i specifies the
                                             i_th layer's output with 0
                                             representing the cell input
                                             tensor.
    - <encoder/decoder>_<left/right>_output_dims: List of absolute output
                                                  dimensions for each layer.
    - <encoder/decoder>_<left/right>_activation: List of activations applied
                                                 after each layer.
                                                 ACTIVATION_MAP holds the valid
                                                 activations.
    - <encoder/decoder>_<left/right>_norms: List of norms applied before each
                                            layer. Must be either "layer_norm"
                                            or "none".
    - <encoder/decoder>_combiner_functions: List of functions used to combine
                                            each left/right branch pair.
                                            Options are listed in
                                            COMBINER_FUNCTIONS.
    - <encoder/decoder>_final_combiner_function: Function applied to combine
                                                 all the block outputs that are
                                                 not used as inputs to other
                                                 blocks. Options are listed in
                                                 COMBINER_FUNCTIONS.
  
  For an example of how to set these hparams, please see nas_seq2seq_base().
class_docstr_tok: ["Configurable","seq2seq","model","used","for","Neural","Architecture","Search",".","Models","are","defined","by","26","hparam","fields",".","They","are",":","-","<","encoder\/decoder",">","_num_cells",":","The","number","of","cells","in","the","<","encoder\/decoder",">",".","-","<","encoder\/decoder",">","_","<","left\/right",">","_layers",":","List","of","layers","used","the","<","encoder\/decoder",">","<","left\/right",">","branch",".","For","available","layers",",","see","the","nas_layers.py","file",".","-","<","encoder\/decoder",">","_","<","left\/right_inputs",">",":","List","of","inputs","to","the","<","encoder\/decoder",">","<","left\/right",">","layers",".","Each","index","i","specifies","the","i_th","layer","'s","output","with","0","representing","the","cell","input","tensor",".","-","<","encoder\/decoder",">","_","<","left\/right",">","_output_dims",":","List","of","absolute","output","dimensions","for","each","layer",".","-","<","encoder\/decoder",">","_","<","left\/right",">","_activation",":","List","of","activations","applied","after","each","layer",".","ACTIVATION_MAP","holds","the","valid","activations",".","-","<","encoder\/decoder",">","_","<","left\/right",">","_norms",":","List","of","norms","applied","before","each","layer",".","Must","be","either","``","layer_norm","''","or","``","none","''",".","-","<","encoder\/decoder",">","_combiner_functions",":","List","of","functions","used","to","combine","each","left\/right","branch","pair",".","Options","are","listed","in","COMBINER_FUNCTIONS",".","-","<","encoder\/decoder",">","_final_combiner_function",":","Function","applied","to","combine","all","the","block","outputs","that","are","not","used","as","inputs","to","other","blocks",".","Options","are","listed","in","COMBINER_FUNCTIONS",".","For","an","example","of","how","to","set","these","hparams",",","please","see","nas_seq2seq_base","(",")","."]
docstr: Decode inputs using _decoder().
  
  This performs the same way as transformer.Transformer.decode with the
  decoder portion replaced with _decoder().
  
  Args:
    decoder_input: Inputs to bottom of the model. [batch_size, decoder_length,
      hidden_dim]
    encoder_output: Encoder representation. [batch_size, input_length,
      hidden_dim]
    encoder_decoder_attention_bias: Bias and mask weights for encoder-decoder
      attention. [batch_size, input_length]
    decoder_self_attention_bias: Bias and mask weights for decoder
      self-attention. [batch_size, decoder_length]
    hparams: Hyperparmeters for model.
    cache: Dict, containing tensors which are the results of previous
      attentions, used for fast decoding.
    nonpadding: Optional Tensor with shape [batch_size, decoder_length]
    losses: Unused losses.
  
  Returns:
    Final decoder representation. [batch_size, decoder_length, hidden_dim]
docstr_tok: ["Decode","inputs","using","_decoder","(",")",".","This","performs","the","same","way","as","transformer.Transformer.decode","with","the","decoder","portion","replaced","with","_decoder","(",")",".","Args",":","decoder_input",":","Inputs","to","bottom","of","the","model",".","[","batch_size",",","decoder_length",",","hidden_dim","]","encoder_output",":","Encoder","representation",".","[","batch_size",",","input_length",",","hidden_dim","]","encoder_decoder_attention_bias",":","Bias","and","mask","weights","for","encoder-decoder","attention",".","[","batch_size",",","input_length","]","decoder_self_attention_bias",":","Bias","and","mask","weights","for","decoder","self-attention",".","[","batch_size",",","decoder_length","]","hparams",":","Hyperparmeters","for","model",".","cache",":","Dict",",","containing","tensors","which","are","the","results","of","previous","attentions",",","used","for","fast","decoding",".","nonpadding",":","Optional","Tensor","with","shape","[","batch_size",",","decoder_length","]","losses",":","Unused","losses",".","Returns",":","Final","decoder","representation",".","[","batch_size",",","decoder_length",",","hidden_dim","]"]
code: def decode(
      self,
      decoder_input,
      encoder_output,
      encoder_decoder_attention_bias,
      decoder_self_attention_bias,
      hparams,
      cache=None,
      nonpadding=None,
      losses=None,
  ):
      """Decode inputs using _decoder().
  
      This performs the same way as transformer.Transformer.decode with the
      decoder portion replaced with _decoder().
  
      Args:
        decoder_input: Inputs to bottom of the model. [batch_size, decoder_length,
          hidden_dim]
        encoder_output: Encoder representation. [batch_size, input_length,
          hidden_dim]
        encoder_decoder_attention_bias: Bias and mask weights for encoder-decoder
          attention. [batch_size, input_length]
        decoder_self_attention_bias: Bias and mask weights for decoder
          self-attention. [batch_size, decoder_length]
        hparams: Hyperparmeters for model.
        cache: Dict, containing tensors which are the results of previous
          attentions, used for fast decoding.
        nonpadding: Optional Tensor with shape [batch_size, decoder_length]
        losses: Unused losses.
  
      Returns:
        Final decoder representation. [batch_size, decoder_length, hidden_dim]
      """
      decoder_input = tf.nn.dropout(
          decoder_input, 1.0 - hparams.layer_prepostprocess_dropout
      )
  
      decoder_output = self._decoder(
          decoder_input,
          encoder_output,
          decoder_self_attention_bias,
          encoder_decoder_attention_bias,
          hparams,
          cache=cache,
          nonpadding=nonpadding,
          save_weights_to=self.attention_weights,
      )
  
      if (
          common_layers.is_xla_compiled()
          and hparams.mode == tf_estimator.ModeKeys.TRAIN
      ):
          # TPU does not react kindly to extra dimensions.
          return decoder_output
  
      # Expand since t2t expects 4d tensors.
      return tf.expand_dims(decoder_output, axis=2)
  
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 2 for calling the NasSeq2Seq obj's underlying member method code with example usage: obj.decode(decoder_input, encoder_output, encoder_decoder_attention_bias, decoder__attention_bias, hparams, cache, nonpadding, losses) and returns: tf, decoder_output