code: def reshape_to_2d(tensor):
      """Converts the given `tensor` to a 2-D `Tensor`."""
      with tf.compat.v1.name_scope(name="reshape_to_2d"):
          rank = tensor.shape.rank if tensor.shape is not None else None
          if rank is not None and rank != 2:
              if rank >= 3:
                  tensor = tf.reshape(
                      tensor, tf.shape(input=tensor)[0:2]
                  )
              else:
                  while tensor.shape.rank < 2:
                      tensor = tf.expand_dims(tensor, -1)
          return tensor
  
file_path: ranking/tensorflow_ranking/python/utils.py
imports: from typing import Callable, Dict, Tuple
  import tensorflow
label_desc: Use image node_id 10 for calling a global function with example usage: reshape_to_2d(tensor) and returns: tensor