title: tensorflow copy variable but not trainable to pretrain next layers
body: <p>I want to implement the autoencoder (to be exact stacked convolutional autoencoder)</p>
  
  <p>here I'd like to pretrain each layer first and then fine-tuning</p>
  
  <p>So I created variables for weight of each layer</p>
  
  <p>ex. W_1 = tf.Variable(initial_value, name,trainable=True etc) for first layer</p>
  
  <p>and I pretrained W_1 of first layer</p>
  
  <p>Then I want to pretrain weight of second layer (W_2)</p>
  
  <p>Here I should use W_1 for calculating input of second layer.</p>
  
  <p>However W_1 is trainable so if I use W_1 directly then tensorflow may train W_1 together.</p>
  
  <p>So I should create W_1_out that keep value of W_1 but not trainable</p>
  
  <p>To be honest I tried to modify code of this site</p>
  
  <p><a href="https://github.com/cmgreen210/TensorFlowDeepAutoencoder/blob/master/code/ae/autoencoder.py" rel="nofollow">https://github.com/cmgreen210/TensorFlowDeepAutoencoder/blob/master/code/ae/autoencoder.py</a></p>
  
  <p>At line 102 it creates variable by following code</p>
  
  <pre><code>self[name_w + "_fixed"] = tf.Variable(tf.identity(self[name_w]),
                                              name=name_w + "_fixed",
                                              trainable=False)
  </code></pre>
  
  <p>However it calls error cause it use uninitialized value</p>
  
  <p>How should I do to copy variable but make it not trainable to pretrain next layers??</p>