1 2 3 4 5 6 7 8
import tensorflow as tf x = tf.placeholder(tf.float32, name='x') y = -x #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', 'train.pbtxt', as_text=True)