title: TensorFlow: How and why to use SavedModel
body: <p>I have a few questions regarding the <code>SavedModel</code> API, whose <a href="https://www.tensorflow.org/programmers_guide/saved_model#overview_of_saving_and_restoring_models" rel="noreferrer">documentation</a> I find leaves a lot of details unexplained.</p>
  
  <p>The first three questions are about what to pass to the arguments of the <code>add_meta_graph_and_variables()</code> method of <code>tf.saved_model.builder.SavedModelBuilder</code>, while the fourth question is about why to use the <code>SavedModel</code> API over <code>tf.train.Saver</code>.</p>
  
  <ol>
  <li><p>What is the format of the <code>signature_def_map</code> argument? Do I normally need to set this argument when saving a model?</p></li>
  <li><p>Similarly, What is the format of the <code>assets_collection</code> argument?</p></li>
  <li><p>Why do you save a list of tags with a metagraph as opposed to just giving it a name (i.e. attaching just one unique tag to it)? Why would I add multiple tags to a given metagraph? What if I try to load a metagrpah from a <code>pb</code> by a certain tag, but multiple metagraphs in that <code>pb</code> match that tag?</p></li>
  <li><p>The documentation argues that it is recommended to use <code>SavedModel</code> to save entire models (as opposed to variables only) in self-contained files. But <code>tf.train.Saver</code> also saves the graph in addition to the variables in a <code>.meta</code> file. So what are the advantages of using <code>SavedModel</code>? The documentation says</p></li>
  </ol>
  
  <blockquote>
    <p>When you want to save and load variables, the graph, and the graph's
    metadata--basically, when you want to save or restore your model--we
    recommend using SavedModel. SavedModel is a language-neutral,
    recoverable, hermetic serialization format. SavedModel enables
    higher-level systems and tools to produce, consume, and transform
    TensorFlow models.</p>
  </blockquote>
  
  <p>but this explanation is quite abstract and doesn't really help me understand what the advantages of <code>SavedModel</code> are. What would be concrete examples where <code>SavedModel</code> (as opposed to <code>tf.train.Saver</code>) would be better to use?</p>
  
  <p>Please note that my question is not a duplicate of <a href="https://stackoverflow.com/questions/33759623/tensorflow-how-to-save-restore-a-model">this question</a>. I'm not asking how to save a model, I am asking very specific questions about the properties of <code>SavedModel</code>, which is only one of multiple mechanisms TensorFlow provides to save and load models. None of the answers in the linked question touch on the <code>SavedModel</code> API (which, once again, is not the same as <code>tf.train.Saver</code>).</p>