title: Storing tensorflow models in memory
body: <p>The program I'm writing involves switching between models during run-time.</p>
  
  <p>I am currently using Saver to save/load models from the disk as specified here: <a href="https://www.tensorflow.org/api_docs/python/state_ops/saving_and_restoring_variables#Saver">https://www.tensorflow.org/api_docs/python/state_ops/saving_and_restoring_variables#Saver</a>.</p>
  
  <p>The models are fairly small and can be stored in memory, so I was wondering if anyone knows of a way to store and restore these models in-memory instead of saving them to disk.</p>
  
  <p>I tried to modify the tensorflow source to save the model to memory however <code>gen_io_ops</code> seems to be generated during compile time. Another possible way is to use memory mapped files. Does anyone know of an easier way?</p>