code: def _expand_to_beam_size(tensor, beam_size):
      """Tiles a given tensor by beam_size.
  
      Args:
        tensor: tensor to tile [batch_size, ...]
        beam_size: How much to tile the tensor by.
  
      Returns:
        Tiled tensor [batch_size, beam_size, ...]
      """
      tensor = tf.expand_dims(tensor, axis=1)
      tile_dims = [1] * tensor.shape.ndims
      tile_dims[1] = beam_size
  
      return tf.tile(tensor, tile_dims)
  
file_path: tensor2tensor/tensor2tensor/utils/beam_search.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import numpy
  from tensor2tensor.layers import common_layers
  import tensorflow.compat.v1
  from tensorflow.python.ops import inplace_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling a global function with example usage: _expand_to_beam_size(tensor, beam_size) and returns: tf