title: Reading a Google Protocol buffer .pb file using protoc
body: <p>I have compiled Google Protobuf from the source and generated the <code>protoc</code> binary. Now, given a <code>.pb</code> file, i.e., <code>tensorflow_inception_v3_stripped_optimized_quantized.pb</code> how am I gonna be able to read its content <strong>without</strong> using the <code>Tensorflow</code> library ?</p>
  
  <p>Currently, I can write a sample reader to dump the event of my <code>.pb</code> file later be read by <code>tensorboard</code>as following: </p>
  
  <pre><code>import tensorflow as tf
  from tensorflow.python.platform import gfile
  
  INCEPTION_LOG_DIR = '/tmp/inception_v3_log'
  
  if not os.path.exists(INCEPTION_LOG_DIR):
      os.makedirs(INCEPTION_LOG_DIR)
  with tf.Session() as sess:
      model_filename = './model/tensorflow_inception_v3_stripped_optimized_quantized.pb'
      with gfile.FastGFile(model_filename, 'rb') as f:
          graph_def = tf.GraphDef()
          graph_def.ParseFromString(f.read())
          _ = tf.import_graph_def(graph_def, name='')
      #writer = tf.train.SummaryWriter(INCEPTION_LOG_DIR, graph_def)
      writer=tf.summary.FileWriter(INCEPTION_LOG_DIR, graph_def)                                                
      writer.close()
  </code></pre>
  
  <p>However, I don't quite get the reason why I compiled <code>protoc</code> for?  Can't it be used as a standalone reader? Or, the mentioned inception.pb file is already using Protocol buffer in the backend of the Tensorflow without the need of using <code>protoc</code>?</p>
  
  <p>commands like these do generate error:</p>
  
  <pre><code>protoc --python_out=. tensorflow_inception_v3_stripped_optimized_quantized.pb
  protoc --cpp_out=. tensorflow_inception_v3_stripped_optimized_quantized.pb
  </code></pre>
  
  <p>As I checked, <code>.pb</code> files are semi-readable, however, I could not find a solid answer to my question anywhere to directly parse this file's content. Am I missing something here? Thanks.</p>