save some variables in tensorflow
<p>I am trying to save some variable ( weights and biases) to use them later but i have detected error, i don't know if my steps is right or not :</p>

<pre><code>graph = tf.Graph()

with graph.as_default():

   weights = {
    'wc1_0': tf.Variable(tf.random_normal([patch_size_1, patch_size_1, num_channels, depth],stddev=0.1)),
    'wc1_1': tf.Variable(tf.random_normal([patch_size_2, patch_size_2, depth, depth], stddev=0.1)), 
     ......
     }

   biases = {
    'bc1_0' : tf.Variable(tf.zeros([depth])), 
    'bc1_1' : tf.Variable(tf.constant(1.0, shape=[depth])),
     .....
     }

def model(data):

   conv_1 = tf.nn.conv2d(data, wc1_0 , [1, 2, 2, 1], padding='SAME')

   hidden_1 = tf.nn.relu(conv_1 + bc1_0)

   pool_1 = tf.nn.max_pool(hidden_1,ksize = [1,5,5,1], strides= [1,2,2,1],padding ='SAME' )
   .......
   .......

weights_saver = tf.train.Saver(var_list=weights)
biases_saver = tf.train.Saver(var_list=biases)

with tf.Session(graph=graph) as sess:

   sess.run()
   for loop....
   ......
   save_path_weights = weights_saver.save(sess, "my_path")
   save_path_biases = biases_saver.save(sess, "my_path")
</code></pre>

<p>when i run the code, i get this erorr:</p>

<pre><code>  conv_1 = tf.nn.conv2d(data, wc1_0 , [1, 2, 2, 1], padding='SAME')
  NameError: global name 'wc1_0' is not defined
</code></pre>

<p>how can i assign the variable in the conv_1 ?</p>

<p>You defined two dictionaries: 1 for weights and 1 for biases.
You have filled the dictionaries with Tensorflow variables objects.. So, why don't you use them?</p>

<pre><code>   conv_1 = tf.nn.conv2d(data,  weights['wc1_0'] , [1, 2, 2, 1], padding='SAME')
   hidden_1 = tf.nn.relu(conv_1 + biases['bc1_0'])
   pool_1 = tf.nn.max_pool(hidden_1,ksize = [1,5,5,1], strides= [1,2,2,1],padding ='SAME' )
</code></pre>

python tensorflow convolution