def assert_rank_at_most(x, rank, data=None, summarize=None, message=None,
                        name=None):
  """
  """
  with tf.compat.v2.name_scope(name or 'assert_rank_at_most'):
    return tf.compat.v1.assert_less_equal(
        tf.rank(x), rank, data=data, summarize=summarize, message=message)