title: Weights Variable modification after creation and still want to train it in Tensorflow
body: <p>Is it possible to reassign weights with different values than the initialized and still train it successfully?</p>
  
  <p>For ex:</p>
  
  <pre><code>Weights= tf.Variable(shape, zeros(), name="weights")
  update_weights = weights + steps * bytes
  Weights = Weights.assign(update_weights)
  </code></pre>
  
  <p>But I get the following error when I train it using AdamOptimizer:</p>
  
  <pre><code>Trying to optimize unsupported type &lt;tf.Tensor 'conv_1/Assign:0' shape=(5, 5, 1, 30) dtype=float32_ref&gt;
  </code></pre>
  
  <p>To convert tensor to variable suitable for minimize() of Adam optimizer: used this:</p>
  
  <pre><code> q_weights = tf.Variable(q_weights.assign(weights))
  </code></pre>
  
  <p>But got the following error!</p>
  
  <pre><code>tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node conv_2/Variable/conv_2/Assign_conv_2/Variable_0 was passed float from conv_2/Variable/cond/Merge:0 incompatible with expected float_ref.
  </code></pre>
  
  <p>Full flow of code attached:</p>
  
  <pre><code>Weights= tf.Variable(shape, zeros(), name="weights")
  update_weights = weights + steps * bytes
  Weights = Weights.assign(update_weights)
  
  conv = tf.nn.conv2d(input, Weights, ...)
  act = tf.nn.relu(...)
  
  tf.add_to_collection('train_params, Weights)
  
  do dot ....
  tf.add_to_collection('train_params, Weights)
  
  
  do all remaining layers.....
  tf.add_to_collection('train_params, Weights)
  
  do logits 
  tf.add_to_collection('train_params, Weights)
  
  loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels, logits)
  
  back_prop = tf.train.AdamOptimizer(LR).minimize(loss, var_list = tf.get_collection('train_params')
  
  repeat for every iteration
  </code></pre>
  
  <p>Thanks for the help.</p>