code: def rank(x):
      """Returns the rank implied by this shape, or `None` if it is unspecified.
  
      For more details, see `help(tf.TensorShape.rank)`.
  
      Note: This is not the rank of the shape itself, viewed as a Tensor, which
      would always be 1; rather, it's the rank of every Tensor of the shape given by
      `x`.
  
      Args:
        x: object representing a shape; anything convertible to `tf.TensorShape`,
          or a `Tensor` (interpreted as an in-graph computed shape).
  
      Returns:
        rank: `int` representing the number of shape dimensions, or `None` if
          not statically known.
      """
      return tf.TensorShape(x).rank
  
file_path: probability/tensorflow_probability/python/internal/tensorshape_util.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
label_desc: Use image node_id 12 for calling a global function with example usage: rank(x) and returns: tf