title: Tensorflow save one of multiple sessions
body: <p>Hi have a Python script where I instantiate two objects of a neural network class.
  Each object defines its own session and provide methods for saving the graph.</p>
  
  <pre><code>import tensorflow as tf
  import os, shutil
  
  class TestNetwork:
  
      def __init__(self, id):
          self.id = id
  
          tf.reset_default_graph()
  
          self.s = tf.placeholder(tf.float32, [None, 2], name='s')
          w_initializer, b_initializer = tf.random_normal_initializer(0., 1.0), tf.constant_initializer(0.1)
          self.k = tf.layers.dense(self.s, 2, kernel_initializer=w_initializer,
                      bias_initializer=b_initializer, name= 'k')
  
          '''Defines self.session and initialize the variables'''
          session_conf = tf.ConfigProto(
              allow_soft_placement = True,
              log_device_placement = False)
          self.session = tf.Session(config = session_conf)
          self.session.run(tf.global_variables_initializer())
  
  
  
      def save_model(self, output_dir):
          '''Save the network graph and weights to disk'''
          if os.path.exists(output_dir):
              # if provided output_dir already exists, remove it
              shutil.rmtree(output_dir)
  
          builder = tf.saved_model.builder.SavedModelBuilder(output_dir)
          builder.add_meta_graph_and_variables(
              self.session,
              [tf.saved_model.tag_constants.SERVING],
              clear_devices=True)
          # create a new directory output_dir and store the saved model in it
          builder.save()
  
  
  t1 = TestNetwork(1)
  t2 = TestNetwork(2)
  
  
  t1.save_model("t1_model")
  t2.save_model("t2_model")
  </code></pre>
  
  <p>The error I get is</p>
  
  <blockquote>
    <p>TypeError: Cannot interpret feed_dict key as Tensor: The name
    'save/Const:0' refers to a Tensor which does not exist. The operation,
    'save/Const', does not exist in the graph.</p>
  </blockquote>
  
  <p>I read something saying that this error is due to <code>tf.train.Saver</code>.</p>
  
  <p>Thus I added the following line at the end of the <code>__init__</code> method:</p>
  
  <pre><code>self.saver = tf.train.Saver(tf.global_variables(), max_to_keep = 5)
  </code></pre>
  
  <p>However I still get the error.</p>