code: def _unmerge_beam_dim(tensor, batch_size, beam_size):
      """Reshapes first dimension back to [batch_size, beam_size].
  
      Args:
          tensor: Tensor to reshape of shape [batch_size*beam_size, ...]
          batch_size: Tensor, original batch size.
          beam_size: int, original beam size.
  
      Returns:
          Reshaped tensor of shape [batch_size, beam_size, ...]
      """
      if not isinstance(tensor, tf.Tensor):
          return tensor
      shape = shape_list(tensor)
      new_shape = [batch_size] + [beam_size] + shape[1:]
      return tf.reshape(tensor, new_shape)
  
file_path: texar/texar/tf/utils/beam_search.py
imports: import tensorflow
  from tensorflow.python.util import nest
  from texar.tf.utils.shapes import shape_list
label_desc: Use image node_id 2 for calling a global function with example usage: _unmerge_beam_dim(tensor, batch_size, beam_size) and returns: tf, tensor