class_docstr: Universal Transformer: Depth-wise recurrent transformer model.
class_docstr_tok: ["Universal","Transformer",":","Depth-wise","recurrent","transformer","model","."]
docstr: Beam search decoding.
  
  Args:
    features: an map of string to `Tensor`
    decode_length: an integer.  How many additional timesteps to decode.
    beam_size: number of beams.
    top_beams: an integer. How many of the beams to return.
    alpha: Float that controls the length penalty. larger the alpha, stronger
      the preference for longer translations.
    use_tpu: Whether we should use TPU or not.
  
  Returns:
    A dict of decoding results {
        "outputs": integer `Tensor` of decoded ids of shape
            [batch_size, <= decode_length] if beam_size == 1 or
            [batch_size, top_beams, <= decode_length]
        "scores": decoding log probs from the beam search,
            None if using greedy decoding (beam_size=1)
    }
docstr_tok: ["Beam","search","decoding",".","Args",":","features",":","an","map","of","string","to","`","Tensor","`","decode_length",":","an","integer",".","How","many","additional","timesteps","to","decode",".","beam_size",":","number","of","beams",".","top_beams",":","an","integer",".","How","many","of","the","beams","to","return",".","alpha",":","Float","that","controls","the","length","penalty",".","larger","the","alpha",",","stronger","the","preference","for","longer","translations",".","use_tpu",":","Whether","we","should","use","TPU","or","not",".","Returns",":","A","dict","of","decoding","results","{","``","outputs","''",":","integer","`","Tensor","`","of","decoded","ids","of","shape","[","batch_size",",","<","=","decode_length","]","if","beam_size","==","1","or","[","batch_size",",","top_beams",",","<","=","decode_length","]","``","scores","''",":","decoding","log","probs","from","the","beam","search",",","None","if","using","greedy","decoding","(","beam_size=1",")","}"]
code: def _beam_decode(
      self,
      features,
      decode_length,
      beam_size,
      top_beams,
      alpha,
      use_tpu=False,
  ):
      """Beam search decoding.
  
      Args:
        features: an map of string to `Tensor`
        decode_length: an integer.  How many additional timesteps to decode.
        beam_size: number of beams.
        top_beams: an integer. How many of the beams to return.
        alpha: Float that controls the length penalty. larger the alpha, stronger
          the preference for longer translations.
        use_tpu: Whether we should use TPU or not.
  
      Returns:
        A dict of decoding results {
            "outputs": integer `Tensor` of decoded ids of shape
                [batch_size, <= decode_length] if beam_size == 1 or
                [batch_size, top_beams, <= decode_length]
            "scores": decoding log probs from the beam search,
                None if using greedy decoding (beam_size=1)
        }
      """
      # Caching is not ebabled in Universal Transformer
      # TODO(dehghani): Support fast decoding for Universal Transformer
      return self._beam_decode_slow(
          features, decode_length, beam_size, top_beams, alpha, use_tpu
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_attention
  from tensor2tensor.layers import common_layers
  from tensor2tensor.models import transformer
  from tensor2tensor.models.research import universal_transformer_util
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 5 for calling the UniversalTransformer obj's underlying member method code with example usage: obj._beam_decode(features, decode_length, beam_size, top_beams, alpha, use_tpu) and returns: self