title: How to structure the model for training and evaluation on the test set
body: <p>I want to train a model. Every 1000 steps, I want to evaluate it on the test set and write it to the tensorboard log. However, there's a problem. I have a code like this:</p>
  
  <pre><code>image_b_train, label_b_train = tf.train.shuffle_batch(...)
  out_train = model.inference(image_b_train)
  accuracy_train = tf.reduce_mean(...)
  
  image_b_test, label_b_test = tf.train.shuffle_batch(...)
  out_test = model.inference(image_b_test)
  accuracy_test = tf.reduce_mean(...)
  </code></pre>
  
  <p>where model inference declares the variables in the model. However, there's a problem. For the test set I have a separate queue, and I can't swap one queue for another with tensorflow.</p>
  
  <p>Currently I solved the problem by creating 2 graphs, one for training and the other for testing. I copy from one graph to the other with tf.train.Saver. Another solution might be to use tf.get_variable, but this is a global variable, and I don't like it because my code becomes less reusable.</p>