<p dir="auto">Hi,</p>
<p dir="auto">I am interested in using scatter_add when the tensor being update is not a variable. Is this possible?</p>
<p dir="auto">I am looking to do something like this:</p>
<p dir="auto"><code class="notranslate">X1_ph = tf.placeholder(tf.float32, shape=(None, 3))</code><br>
<code class="notranslate">ind_ph = tf.placeholder(tf.int32, shape=(None))</code></p>
<p dir="auto"><code class="notranslate">#Z = tf.Variable(tf.zeros([10, 3]))</code><br>
<code class="notranslate">Z = tf.zeros([10, N_feat])</code></p>
<p dir="auto"><code class="notranslate">X1 = np.array([[1,0.00,1],</code><br>
<code class="notranslate">[2,0.00,1],</code><br>
<code class="notranslate">[3,0.00,1],</code><br>
<code class="notranslate">[5,0.00,1.1],</code><br>
<code class="notranslate">[6,1.0,1.8]])</code></p>
<p dir="auto"><code class="notranslate">ind = [0, 1, 1, 0, 0]</code></p>
<p dir="auto"><code class="notranslate">Z = tf.scatter_add(Z, ind_ph, X1)</code></p>
<p dir="auto">If I declare Z as a tf.Variable, I can do this, but I need to call this operation hundreds of thousands of times, and do not want to store any copies of Z once I am done with them. If I were to declare Z as a Variable, would there be any way to destroy Z once I am done with it (maybe with a garbage collector or something similar)? Thank you so much for your help!</p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes</li>
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: No idea</li>
<li>TensorFlow installed from (source or binary): binary using pip3 install</li>
<li>TensorFlow version (use command below): 1.14</li>
<li>Python version: 3.6</li>
<li>Bazel version (if compiling from source):</li>
<li>GCC/Compiler version (if compiling from source):</li>
<li>CUDA/cuDNN version: cuda9.0, cudnn 7.6</li>
<li>GPU model and memory: RTX 2080Ti</li>
</ul>
<p dir="auto">When I run the following code using CPU:<br>
<code class="notranslate">result= tf.math.log(tf.constant([280.41303540865516]*100, dtype=tf.float32)).numpy()</code><br>
I got:<br>
<code class="notranslate"> [5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.6362634 5.636264  5.636264 5.636264  5.636264 ]</code></p>
<p dir="auto">I found result[0] is not equal to result[-1]. the first one is<br>
5.636263370513916 while the latter one is equal to 5.636263847351074.</p>
<p dir="auto">I believe it is a bug.</p>
<p dir="auto"><strong>Code to reproduce the issue</strong><br>
<code class="notranslate"> from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf from random import * tf.enable_eager_execution() with tf.device("/cpu:0"): result = tf.math.log(tf.constant([ 280.41303540865516]*100, dtype=tf.float32)).numpy() print("{} vs {}".format(result[0], result[-1]))</code></p>
<p dir="auto">Seems GPU has no such issues.</p>