title: Is it possible to calculate two kinds of gradient separately in tensorflow
body: <pre><code>w_1   = tf.get_variable("w_1", shape)   
  w_2   = tf.get_variable("w_2", shape) 
  output = tf.mul(w_1, w_2)
  .....
  .....
  optimizer = tf.train.AdamOptimizer(alpha).minimize(self.cost)
  </code></pre>
  
  <p>As we know, when we run "optimizer", tensorflow will caculate gradient and update w_1 &amp; w_2.</p>
  
  <p>But what i want to do is, first, I want to <strong>treat w_1 as a constant</strong>, I just want to caculate gradient and update <strong>only w_2</strong>. Second, <strong>treat w_2 as a constant</strong> and caculate gradient and update <strong>only w_1</strong>. I want to <strong>take turns</strong> to do these things. </p>
  
  <p>Actually, I have seen this before: <a href="https://stackoverflow.com/questions/34477889/holding-variables-constant-during-optimizer/34478044#34478044">enter link description here</a>. But I use <strong>BasicLSTMCell</strong> module.  I try this code: <code>print (tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES))</code>, it shows there are <strong>four</strong> kinds of parameter in my neural network, <strong>which means besides w_1 and w_2, there are other two parameters in  BasicLSTMCell.</strong> 
  So, if I use such as <code>var_list=[w_1]</code>, the other two parameters in BasicLSTMCell  can not be optimized, How can I do it? </p>