from tensorflow.python.ops import math_ops

    rank = array_ops.rank(top_k_predictions)
    check_rank_op = control_flow_ops.Assert(
        math_ops.greater_equal(rank, 2),
        ['top_k_predictions must have rank 2 or higher, e.g. [batch_size, k].'])
