title: How to get weights from tensorflow fully_connected
body: <p>I'm trying to extract the weights from a model after training it. Here's a toy example</p>
  
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  import numpy as np
  
  X_ = tf.placeholder(tf.float64, [None, 5], name="Input")
  Y_ = tf.placeholder(tf.float64, [None, 1], name="Output")
  
  X = ...
  Y = ...
  with tf.name_scope("LogReg"):
      pred = fully_connected(X_, 1, activation_fn=tf.nn.sigmoid)
      loss = tf.losses.mean_squared_error(labels=Y_, predictions=pred)
      training_ops = tf.train.GradientDescentOptimizer(0.01).minimize(loss)
  
  with tf.Session() as sess:
      sess.run(tf.global_variables_initializer())
      for i in range(200):
          sess.run(training_ops, feed_dict={
              X_: X,
              Y_: Y
          })
          if (i + 1) % 100 == 0:
              print("Accuracy: ", sess.run(accuracy, feed_dict={
                  X_: X,
                  Y_: Y
              }))
  
  # Get weights of *pred* here
  </code></pre>
  
  <p>I've looked at <a href="https://stackoverflow.com/questions/36412065/get-weights-from-tensorflow-model">Get weights from tensorflow model
  </a> and at the <a href="https://www.tensorflow.org/api_docs/python/tf/Summary/Value" rel="noreferrer">docs</a> but can't find a way to retrieve the value of the weights.</p>
  
  <p>So in the toy example case, suppose that X_ has shape (1000, 5), how can I get the 5 values in the 1-layer weights after </p>