code: def _to_matrix(u):
      """If input tensor is a vector (i.e., has rank 1), converts it to matrix."""
      u_rank = len(u.shape)
      if u_rank not in [1, 2]:
          raise ValueError(
              "The input tensor should have rank 1 or 2. Given rank: {}".format(
                  u_rank
              )
          )
      if u_rank == 1:
          return array_ops.expand_dims(u, 0)
      return u
  
imports: from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
label_desc: Use image node_id 1 for calling a global function with example usage: _to_matrix(u) and returns: u, array_ops