title: AttributeError: __enter__ from "with tf.Session as sess:"
body: <p>So, this might be a dumb or obvious question but bear with me. I'm a mathematics student, and I'm in my final year and have been learning to work with neural nets for fun. I am no programmer so errors are something I encounter frequently. Usually I can sort them out, today however I received one I just can't figure out. When I attempt to execute my code I get an error saying:</p>
  
  <pre><code>"Traceback (most recent call last):
  File "C:\Python Practice\gan.py", line 93, in &lt;module&gt;
  n()
  File "C:\Python Practice\gan.py", line 73, in nn
  with tf.Session as sess:
  AttributeError: __enter__
  </code></pre>
  
  <p>The code from line 72 until the end looks like:</p>
  
  <pre><code>def network_run():
  with tf.Session as sess:
      sess.run(tf.global_variables_initializer())
      for i in range(200):
          sess.run(opt_D, feed_dict={x_ten: images[np.random.choice(range(len(images)), batch_size)].reshape(batch_size, x_ten_size), 
          z_ten:z_noise(batch_size)})
          sess.run(opt_G, feed_dict={z_ten:z_noise(batch_size)})
          sess.run(opt_G, feed_dict={z_ten:z_noise(batch_size)})
  
          gen_cost=sess.run(G_img, feed_dict={z_ten:z_noise(batch_size)})
          disc_cost=sess.run(D_img, feed_dict={x_ten: images[np.random.choice(range(len(images)), batch_size)].reshape(batch_size, x_ten_size), 
          z_ten:z_noise(batch_size)})
  
          image=sess.run(G(z_ten), feed_dict={z_ten:z_noise(batch_size)})
          df=sess.run(tf.sigmoid(D_img_fake), feed_dict={z_ten:z_noise()})
          print (i, gen_cost, disc_cost, image.max(), df[0][0])
  
      image=sess.run(G(z_ten), feed_dict={z_ten:z_noise(batch_size)})
      image1 = image[0].reshape([28, 28])
      im = Image.fromarray(image1)
      im.show()
    network_run()
  </code></pre>
  
  <p>Thanks in advance to anyone who helps this blubbering fool out- Max</p>