# Calculating Top k Text prediction using Tensorflow

I would like to adapt the code of PTB Tensorflow code [https://github.com/tensorflow/models/blob/master/tutorials/rnn/ptb/ptb_word_lm.py], in order to calculate top k predicted word samples, on the basis of given input word sequence? I am confused in the answer mentioned here [How Tensorflow text prediction predicts without softmax activation.

Following can be the options:

Option 1: We can use tf.multinomial, which is similar to tf.random.categorical

k=10
self.predictions = tf.multinomial(logits, k)


Option 2: The other option can be to call a specific function, which will output the value coming from the following line, in k number of times.

self.prediction=tf.argmax(logits,1)


Which option will give me fair experimental results?