title: using multiple separate neural nets on the same tensor-flow import
body: <p>I have built a generic python class for interacting with trained neural networks that are saved using "tf.saved_model.builder.SavedModelBuilder".</p>
  
  <p>when I inherit from the class once with a given neural net, everything works correctly. however, when i inherit once more with a second neural net with different architecture, tensor flow throws an error that the shape doesn't fit:
  "Assign requires shapes of both tensors to match. lhs shape= [100,2] rhs shape= [400,4]"</p>
  
  <p>these shapes are of the two different neural nets, but I don't see why would tensor flow remember about the first net.</p>
  
  <p>Is there an easy way to fix this? and if not, what is the correct way of using multiple neural networks in a project?</p>
  
  <p>here's the class code:</p>
  
  <pre><code>import tensorflow as tf
  
  
  # prevents tensorflow from using GPU
  config = tf.ConfigProto(
    device_count={'GPU': 0}
  )
  
  
  class TFService():
  
    def __init__(self, netName, inputName, outputName):
      # opens a tensorflow session to use continously
      self.session = tf.Session(config=config)
  
      # loads the trained neural net
      importDir = 'ocr/neural_nets/{}'.format(netName)
  
      tf.saved_model.loader.load(
        self.session,
        [tf.saved_model.tag_constants.SERVING],
        importDir
      )
  
      # saves the input and output tensors for the net
      self.x = tf.get_default_graph().get_tensor_by_name(inputName)
      self.y_pred = tf.get_default_graph().get_tensor_by_name(outputName)
  
    def getPredictions(self, inputData):
      # the object to feed the neural net
      feed_dict = {self.x: inputData}
  
      # runs the neural net and returns an array with the predictions
      results = self.session.run(self.y_pred, feed_dict=feed_dict)
  
      return results
  </code></pre>