def rank(x):
return tf.TensorShape(x).rank<EOL>
Returns the rank of this shape, or `None` if it is unspecified.

    For more details, see `help(tf.TensorShape.rank)`.

    Args:
      x: object representing a shape; convertible to `tf.TensorShape`.

    Returns:
      rank: `int` representing the number of shape dimensions.