code: def _merge_beam_dim(tensor):
      """Reshapes first two dimensions in to single dimension.
  
      Args:
          tensor: Tensor to reshape of shape [A, B, ...]
  
      Returns:
          Reshaped tensor of shape [A*B, ...]
      """
      if not isinstance(tensor, tf.Tensor):
          return tensor
      shape = shape_list(tensor)
      shape[0] *= shape[1]  # batch -> batch * beam_size
      shape.pop(1)  # Remove beam dim
      return tf.reshape(tensor, 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 1 for calling a global function with example usage: _merge_beam_dim(tensor) and returns: tf, tensor