title: Tensorarray initialization
body: <p>I am writing an example program to learn distributed tensorflow on 4 nodes. My program consists of assigning values to a simple numpy array. Then I convert them into tensorflow arrays to do a basic arithmetic addition operation. I store the outputs in another tensorflowarray. Finally convert this array into tensor to print it in the output.  </p>
  
  <pre><code>import tensorflow as tf
  import numpy as np
  import datetime
  
  u1 = tf.TensorArray(dtype=tf.float64,size=101)
  u2 = tf.TensorArray(dtype=tf.float64,size=101)
  u3 = tf.TensorArray(dtype=tf.float64,size=101)
  u4 = tf.TensorArray(dtype=tf.float64,size=101)
  u5 = tf.Variable(np.zeros(101))
  u = np.zeros(101)
  a = tf.Variable(0, dtype=tf.float64)
  L = 100.0
  
  x = tf.constant(2, dtype=tf.float64)
  
  t1 = datetime.datetime.now()
  with tf.device("/job:local/task:3"):
      for i in range(2):
          for j in range(101):
              # u[j] = (np.sin(2*np.pi*j/L))
              u[j] = j
              u1 = u1.write(j,u[j])
              u2 = u2.write(j,u[j])
              u3 = u3.write(j,u1.read(j)+u2.read(j))
  
          u4 = u3.pack()
          assign = tf.assign(u5, u3(100))
  
  
  model = tf.initialize_all_variables()
  
  with tf.Session("grpc://localhost:2222") as sess:
      sess.run(model)
      print sess.run(u4)
      print sess.run(assign)
      # print (u4.eval())
  t2 = datetime.datetime.now()
  
  print('\n')
  print "Multi node computation time: " + str(t2-t1)
  </code></pre>
  
  <p>I want to overwrite the tensorarrays u1,u2,u3,u4. The above written program gives the following error:-</p>
  
  <pre><code>InvalidArgumentError (see above for traceback): TensorArray TensorArray_1_21: Could not write to TensorArray index 0 because it has already been read.
  </code></pre>
  
  <p>Is there anyway to initialize the used tensorarrays after the first for loop? Please help.</p>