title: TensorFlow: Access Contents of a Variable By Name
body: <p>I have the following situation: </p>
  
  <p>I have already built, trained and saved my net.  Now, I am trying to restore the net and visualize the weight matrices.  </p>
  
  <p>I know all the names for the variables, but I don't have a python marker assigned to the variable to pass to the session for evaluation.  How do I retrieve the data in the variable?</p>
  
  <p>Here is my code situation:</p>
  
  <pre><code>dataset_params = nn_params.mnist_dataset_params
  design = nn_designs.mnist_net_A_design
  ## Build Housing Object
  mnist_nn = nn_class.CNN(**dataset_params)
  mnist_nn.build_net(design['design'])
  mnist_nn.__setattr__('saved_path',saved_model)
  mnist_nn_epoch_file = saved_model+'_epochs_completed.txt'
  mnist_nn.__setattr__('epoch_file',mnist_nn_epoch_file)
  
  
  # evaluate weight variables
  session = tf.Session()
  saver = tf.train.Saver()
  session.run(tf.initialize_all_variables())
  saver.restore(session,saved_model)
  
  
  
  
  session.close()
  </code></pre>
  
  <p>What should I pass to session in order to pull out the weights? (An example weight name is: 'conv_w_1')? </p>