# This file is useful for reading the contents of the ops generated by ruby 
# in pb file. You can read any graph defination in pb format generated by ruby 
# or by python and this will convert it to pbtxt format which can easily be interpretted
# by
import tensorflow as tf
from tensorflow.python.platform import gfile

def converter(filename): 
  with gfile.FastGFile(filename,'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    tf.import_graph_def(graph_def, name='')
    tf.train.write_graph(graph_def, 'pbtxt/', 'protobuf.pb', as_text=True)
  return

converter('wire_test.pb')  # here you can write the name of the file to be converted
# and then a new file will be made in pbtxt directory.