import tensorflow as tf
w = tf.Variable(0.0, name='w')
b = tf.Variable(0.0, name='b')
x = tf.placeholder(tf.float32, name='x')
y = w * x + b
#tmp = tf.mul(x, 3, name='tmp')
#y = tf.mul(tmp, 2, name='y')
sess = tf.Session()
tf.train.write_graph(sess.graph_def, '/tmp/my-model-txt', 'train.pbtxt', as_text=True)
tf.train.write_graph(sess.graph_def, '/tmp/my-model', 'train.pb', as_text=False)