title: TensorFlow: Optimize for Inference a SavedModel exported by Estimator
body: <p>I'm trying to optimize a saved graph for inference, so I can use it in Android. </p>
  
  <p>My first attempt at using the optimize_for_inference script failed with </p>
  
  <pre><code>google.protobuf.message.DecodeError: Truncated message
  </code></pre>
  
  <p>So my question is whether the input/output nodes are wrong or the script cannot handle SavedModels (although it's the same extension as a frozen graph .pb)</p>
  
  <p>Regarding the first: since with Estimators we provide input_fn instead of the data itself, which should be considered the input? The first tf operation on it? Like:</p>
  
  <pre><code>x = x_dict['gestures']
  
  # Data input is a 1-D vector of x_dim * y_dim features ("pixels")
  # Reshape to match format [Height x Width x Channel]
  # Tensor input become 4-D: [Batch Size, Height, Width, Channel]
  x = tf.reshape(x, shape=[-1, x_dim, y_dim, 1], name='input')
  
  (...)
  
  pred_probs = tf.nn.softmax(logits, name='output')
  </code></pre>
  
  <p>BTW: if there is something different in loading a SavedModel in Android, I'd like to know too.</p>
  
  <p>Thank you in advance! </p>