From f0b3a02cb76be13364d0247b0162c23482778f9c Mon Sep 17 00:00:00 2001 From: Ruizhi Date: Thu, 2 Aug 2018 14:16:04 +0800 Subject: [PATCH] Removed redundant tf.exp on predictions in evaluate method In the `evaluate` method, the usage of `tf.exp` seems redundant here, since `predictions` itself is the logits output of a dense layer in decoder. Therefore, I removed `tf.exp` so that `tf.multinomial` is applied on the logits directly, which agrees better with the proper usage of `tf.multinomial`. --- .../python/examples/nmt_with_attention/nmt_with_attention.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb b/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb index 0408ef01caa..0bc1c405ced 100644 --- a/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb +++ b/tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb @@ -753,7 +753,7 @@ " attention_weights = tf.reshape(attention_weights, (-1, ))\n", " attention_plot[t] = attention_weights.numpy()\n", "\n", - " predicted_id = tf.multinomial(tf.exp(predictions), num_samples=1)[0][0].numpy()\n", + " predicted_id = tf.multinomial(predictions, num_samples=1)[0][0].numpy()\n", "\n", " result += targ_lang.idx2word[predicted_id] + ' '\n", "\n",