code: def shape_list(x):
      r"""Returns **static** shape of the input Tensor whenever possible.
  
      Args:
          x: A Tensor.
  
      Returns:
          - If the rank of `x` is unknown, returns the dynamic shape
            ``tf.shape(x)``
  
          - Otherwise, returns a list of dims, each of which is either an `int`
            whenever it can be statically determined, or a scalar Tensor
            otherwise.
      """
      x = tf.convert_to_tensor(x)
      # If unknown rank, return dynamic shape
      if x.get_shape().dims is None:
          return tf.shape(x)
      static = x.get_shape().as_list()
      shape = tf.shape(x)
      ret = []
      for i, dim in enumerate(static):
          if dim is None:
              dim = shape[i]
          ret.append(dim)
      return ret
  
file_path: texar/texar/tf/utils/shapes.py
imports: import numpy
  import tensorflow
  from tensorflow.python.util import nest
  from tensorflow.python.ops import rnn
  from tensorflow.python.framework import ops
label_desc: Use image node_id 9 for calling a global function with example usage: shape_list(x) and returns: ret, tf