def top_k_op(predictions, targets, k=1):
    with tf.name_scope('Top_' + str(k)):
        targets = tf.cast(targets, tf.int32)
        correct_pred = tf.nn.in_top_k(predictions, tf.argmax(targets, 1), k)
        acc = tf.reduce_mean(tf.cast(correct_pred, tf.float32))
    return acc
top_k_op.
dataset/ETHPy150Open tflearn/tflearn/tflearn/metrics.py/top_k_op