Clearing Tensorflow GPU memory after model execution : <p>I've trained 3 models and am now running code that loads each of the 3 checkpoints in sequence and runs predictions using them. I'm using the GPU.</p>

<p>When the first model is loaded it pre-allocates the entire GPU memory (which I want for working through the first batch of data). But it doesn't unload memory when it's finished. When the second model is loaded, using both <code>tf.reset_default_graph()</code> and <code>with tf.Graph().as_default()</code> the GPU memory still is fully consumed from the first model, and the second model is then starved of memory.</p>

<p>Is there a way to resolve this, other than using Python subprocesses or multiprocessing to work around the problem (the only solution I've found on via google searches)?</p>
