code: def _expand_to_beam_size(tensor, 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)
docs: 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, ...]