title: Tensorflow: empty computational graph & garbage collection
body: <p>1 EMPTY GRAPH ERROR</p>
  
  <p>Hey I am trying to run multiple tensorflow graphs completely separate and am running into the following inheritance problem.</p>
  
  <p>Also does </p>
  
  <pre><code>import tensorflow as tf
  
  
  class A:
  
      g = tf.Graph()
      g.as_default()
      s = tf.Session(graph=g)
  
      x = tf.placeholder(tf.float32)
  
      __call__ = lambda self,X: self.s.run(self.y, {self.x:X})
  
  
  class B(A):
  
      y = 2 * A.x
  
  
  test = B()
  print test([1,1,2])
  </code></pre>
  
  <p>error</p>
  
  <pre><code>RuntimeError: The Session graph is empty.  Add operations to the graph before calling run()
  </code></pre>
  
  <hr>
  
  <p>2 - GARBAGE COLLECTION</p>
  
  <p>I am also curious to find out about deleting these distinct graphs, if I close the session with Session().close() and it is the only session aware of the graph will this graph now disappear and be garbage collected?</p>