title: How to save and restore a tf.estimator.Estimator model with export_savedmodel?
body: <p>I started using Tensorflow recently and I try to get use to tf.estimator.Estimator objects. I would like to do something a priori quite natural: after having trained my classifier, i.e. an instance of tf.estimator.Estimator (with the <code>train</code> method), I would like to save it in a file (whatever the extension) and then reload it later to predict the labels for some new data. Since the official documentation recommends to use Estimator APIs, I guess something as important as that should be implemented and documented.</p>
  
  <p>I saw on some other page that the method to do that is <code>export_savedmodel</code> (see <a href="https://www.tensorflow.org/api_docs/python/tf/contrib/learn/Estimator#export_savedmodel" rel="nofollow noreferrer">the official documentation</a>) but I simply don't understand the documentation. There is no explanation of how to use this method. What is the argument <code>serving_input_fn</code>? I never encountered it in the <a href="https://www.tensorflow.org/guide/custom_estimators" rel="nofollow noreferrer">Creating Custom Estimators</a> tutorial or in any of the tutorials that I read. By doing some googling, I discovered that around a year ago the estimators where defined using an other class (<code>tf.contrib.learn.Estimator</code>) and it looks like the tf.estimator.Estimator is reusing some of the previous APIs. But I don't find clear explanations in the documentation about it.</p>
  
  <p>Could someone please give me a toy example? Or explain me how to define/find this <code>serving_input_fn</code>?</p>
  
  <p>And then how would be load the trained classifier again?</p>
  
  <p>Thank you for your help!</p>
  
  <p><strong>Edit:</strong> I discovered that one doesn't necessarily need to use export_savemodel to save the model. It is actually done automatically. Then if we define later a new estimator having the same model_dir argument, it will also automatically restore the previous estimator, as explained <a href="https://www.tensorflow.org/guide/checkpoints" rel="nofollow noreferrer">here</a>.</p>