title: How to assign a value to a TensorFlow variable?
body: <p>I am trying to assign a new value to a tensorflow variable in python.</p>
  
  <pre><code>import tensorflow as tf
  import numpy as np
  
  x = tf.Variable(0)
  init = tf.initialize_all_variables()
  sess = tf.InteractiveSession()
  sess.run(init)
  
  print(x.eval())
  
  x.assign(1)
  print(x.eval())
  </code></pre>
  
  <p>But the output I get is</p>
  
  <pre><code>0
  0
  </code></pre>
  
  <p>So the value has not changed. What am I missing?</p>