title: Given a tensor flow model graph, how to find the input node and output node names
body: <p>I use custom model for classification in Tensor flow Camera Demo.
  I generated a .pb file (serialized protobuf file) and I could display the huge graph it contains. 
  To convert this graph to a optimized graph, as given in [<a href="https://www.oreilly.com/learning/tensorflow-on-android]" rel="noreferrer">https://www.oreilly.com/learning/tensorflow-on-android]</a>, the following procedure could be used: </p>
  
  <pre><code>$ bazel-bin/tensorflow/python/tools/optimize_for_inference  \
  --input=tf_files/retrained_graph.pb \
  --output=tensorflow/examples/android/assets/retrained_graph.pb
  --input_names=Mul \
  --output_names=final_result
  </code></pre>
  
  <p>Here how to find the input_names and output_names from the graph display.
  When I dont use proper names, I get device crash:</p>
  
  <pre><code>E/TensorFlowInferenceInterface(16821): Failed to run TensorFlow inference 
  with inputs:[AvgPool], outputs:[predictions]
  
  E/AndroidRuntime(16821): FATAL EXCEPTION: inference
  
  E/AndroidRuntime(16821): java.lang.IllegalArgumentException: Incompatible 
  shapes: [1,224,224,3] vs. [32,1,1,2048]
  
  E/AndroidRuntime(16821):     [[Node: dropout/dropout/mul = Mul[T=DT_FLOAT, 
  _device="/job:localhost/replica:0/task:0/cpu:0"](dropout/dropout/div, 
  dropout/dropout/Floor)]]
  </code></pre>