<p dir="auto">NOTE: Only file GitHub issues for bugs and feature requests.  All other topics will be closed.</p>
<p dir="auto">I'm now using TF version 0.10.0 installed from source.<br>
I'm not sure its a bug or intended implementation but the <code class="notranslate">embedding_lookup()</code> returns zeros when the index exceed embedding matrix size. For example,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" import tensorflow as tf
 import numpy as np

 embd_mat = np.linspace(1,10,10).reshape([10,1])*np.array([1,2,3]).reshape([1,3])
 idx = np.linspace(0,19,20)

 embd_in = tf.placeholder(tf.float32,[10,3])
 idx_in = tf.placeholder(tf.int32,[20])

 output = tf.nn.embedding_lookup(embd_in,idx_in)

 with tf.Session() as sess:
     sess.run(tf.initialize_all_variables())

     embd_out = sess.run(output,feed_dict={embd_in:embd_mat, idx_in:idx})

     print embd_out"><pre class="notranslate"><code class="notranslate"> import tensorflow as tf
 import numpy as np

 embd_mat = np.linspace(1,10,10).reshape([10,1])*np.array([1,2,3]).reshape([1,3])
 idx = np.linspace(0,19,20)

 embd_in = tf.placeholder(tf.float32,[10,3])
 idx_in = tf.placeholder(tf.int32,[20])

 output = tf.nn.embedding_lookup(embd_in,idx_in)

 with tf.Session() as sess:
     sess.run(tf.initialize_all_variables())

     embd_out = sess.run(output,feed_dict={embd_in:embd_mat, idx_in:idx})

     print embd_out
</code></pre></div>
<p dir="auto">The output of above code is,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[[  1.   2.   3.]
 [  2.   4.   6.]
 [  3.   6.   9.]
 [  4.   8.  12.]
 [  5.  10.  15.]
 [  6.  12.  18.]
 [  7.  14.  21.]
 [  8.  16.  24.]
 [  9.  18.  27.]
 [ 10.  20.  30.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]]"><pre class="notranslate"><code class="notranslate">[[  1.   2.   3.]
 [  2.   4.   6.]
 [  3.   6.   9.]
 [  4.   8.  12.]
 [  5.  10.  15.]
 [  6.  12.  18.]
 [  7.  14.  21.]
 [  8.  16.  24.]
 [  9.  18.  27.]
 [ 10.  20.  30.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]]
</code></pre></div>
<p dir="auto">Is there any reason it returns zeros not raises an error?<br>
I think that case happens only when programmers make a mistake.<br>
Unless there is any specific reason which I don't know of, I think it should raise a value error that the index is exceeding the matrix size.</p>
<p dir="auto">NOTE: Only file GitHub issues for bugs and feature requests.  All other topics will be closed.</p>
<p dir="auto">I wrote an issues a month ago about the same problem <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="185907028" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/5260" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/5260/hovercard" href="https://github.com/tensorflow/tensorflow/issues/5260">#5260</a><br>
I recently update the TF to latest master branch(<code class="notranslate">0.11.head</code>) without any custom modification and the commit hash is <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tensorflow/tensorflow/commit/55dbc54192a378c5e685c52595f42503f037320e/hovercard" href="https://github.com/tensorflow/tensorflow/commit/55dbc54192a378c5e685c52595f42503f037320e"><tt>55dbc54</tt></a></p>
<p dir="auto">The tf.embedding_lookup() still do not raise error even though the index is exceeding the embedding matrix size. It automatically fills zeros as you can see in the below example.</p>
<p dir="auto">I tested same code with two different machines and the result was same.<br>
In the previous issue(<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="185907028" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/5260" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/5260/hovercard" href="https://github.com/tensorflow/tensorflow/issues/5260">#5260</a>), <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/strategist333/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/strategist333">@strategist333</a> said it raise an <code class="notranslate">InvalidArgumentError</code> in binary release.<br>
But when I tested TF installed from source, it didn't...</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" import tensorflow as tf
 import numpy as np

 embd_mat = np.linspace(1,10,10).reshape([10,1])*np.array([1,2,3]).reshape([1,3])
 idx = np.linspace(0,19,20)

 embd_in = tf.placeholder(tf.float32,[10,3])
 idx_in = tf.placeholder(tf.int32,[20])

 output = tf.nn.embedding_lookup(embd_in,idx_in)

 with tf.Session() as sess:
     sess.run(tf.initialize_all_variables())

     embd_out = sess.run(output,feed_dict={embd_in:embd_mat, idx_in:idx})

     print embd_out"><pre class="notranslate"><code class="notranslate"> import tensorflow as tf
 import numpy as np

 embd_mat = np.linspace(1,10,10).reshape([10,1])*np.array([1,2,3]).reshape([1,3])
 idx = np.linspace(0,19,20)

 embd_in = tf.placeholder(tf.float32,[10,3])
 idx_in = tf.placeholder(tf.int32,[20])

 output = tf.nn.embedding_lookup(embd_in,idx_in)

 with tf.Session() as sess:
     sess.run(tf.initialize_all_variables())

     embd_out = sess.run(output,feed_dict={embd_in:embd_mat, idx_in:idx})

     print embd_out
</code></pre></div>
<p dir="auto">The output of above code is,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[[  1.   2.   3.]
 [  2.   4.   6.]
 [  3.   6.   9.]
 [  4.   8.  12.]
 [  5.  10.  15.]
 [  6.  12.  18.]
 [  7.  14.  21.]
 [  8.  16.  24.]
 [  9.  18.  27.]
 [ 10.  20.  30.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]]"><pre class="notranslate"><code class="notranslate">[[  1.   2.   3.]
 [  2.   4.   6.]
 [  3.   6.   9.]
 [  4.   8.  12.]
 [  5.  10.  15.]
 [  6.  12.  18.]
 [  7.  14.  21.]
 [  8.  16.  24.]
 [  9.  18.  27.]
 [ 10.  20.  30.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]
 [  0.   0.   0.]]
</code></pre></div>