<p dir="auto">What I want to do is retrieving(or slicing 1-element) from tensor with tensor indices.</p>
<p dir="auto">for example,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="data = tf.constant( [ [1,2,3], [4,5,6] ] )
i = tf.constant(2)
j = tf.constant(1)

k = data[i,j]    # error
l = tf.gather( tf.gather(data, i) , j) # ok. but generate errors when gradient optimization process.."><pre class="notranslate"><code class="notranslate">data = tf.constant( [ [1,2,3], [4,5,6] ] )
i = tf.constant(2)
j = tf.constant(1)

k = data[i,j]    # error
l = tf.gather( tf.gather(data, i) , j) # ok. but generate errors when gradient optimization process..
</code></pre></div>
<p dir="auto"><code class="notranslate">sess.run(k, ...)</code> generates bad slice errors.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" data[i,j]
  File &quot;/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py&quot;, line 129, in _SliceHelper
    raise TypeError(&quot;Bad slice index %s of type %s&quot; % (s, type(s)))"><pre class="notranslate"><code class="notranslate"> data[i,j]
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 129, in _SliceHelper
    raise TypeError("Bad slice index %s of type %s" % (s, type(s)))
</code></pre></div>
<p dir="auto"><code class="notranslate">tf.gather</code> is ok to slice element, but it yields errors when training time (<code class="notranslate">tf.train.GradientDescentOptimizer.minimize</code>)</p>
<p dir="auto">Any tips to work-around this problem?</p>
<h3 dir="auto">Issue:</h3>
<p dir="auto">TFLearn estimator summary writer fails because _write_dict_to_summary() in <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/learn/python/learn/estimators/estimator.py#L324">/tensorflow/contrib/learn/python/learn/estimators/estimator.py</a> dose not allow int values, which naturally stops the np.int64 valued 'global_step' parameter from being written, thus causing the summary writer to fail.</p>
<h3 dir="auto">How to reproduce:</h3>
<p dir="auto">Try and run <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py">wide_n_deep_tutorial.py</a>, and you will get:</p>
<p dir="auto"><code class="notranslate">INFO:tensorflow:Saving dict for global step 202: accuracy = 0.818254, accuracy/baseline_label_mean = 0.236226, accuracy/threshold_0.500000_mean = 0.818254, auc = 0.742517, global_step = 202, labels/actual_label_mean = 0.236226, labels/prediction_mean = 0.182356, loss = 0.680463, precision/positive_threshold_0.500000_mean = 0.764145, recall/positive_threshold_0.500000_mean = 0.333593 WARNING:tensorflow:Skipping summary for global_step, must be a float or np.float32.</code></p>
<h3 dir="auto">Pull Request:</h3>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="208015582" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/7555" data-hovercard-type="pull_request" data-hovercard-url="/tensorflow/tensorflow/pull/7555/hovercard" href="https://github.com/tensorflow/tensorflow/pull/7555">#7555</a></p>