code: def assert_has_rank(x, rank):  # pylint: disable=redefined-outer-name
      """Raises an exception if `x` is not compatible with the given `rank`.
  
      For more details, see `help(tf.TensorShape.assert_has_rank)`.
  
      Args:
        x: object representing a shape; convertible to `tf.TensorShape`.
        rank: an `int` representing the minimum required rank of `x`.
  
      Returns:
        None
  
      Raises:
        ValueError: If `x` does not represent a shape with the given `rank`.
      """
      tf.TensorShape(x).assert_has_rank(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 3 for calling a global function with example usage: assert_has_rank(x, rank) without return types