Reputation: 12461
These are sample code.
import tensorflow as tf
const1 = tf.constant(2)
const2 = tf.constant(3)
add_op = tf.add(const1,const2)
mul_op = tf.mul(add_op,const2)
with tf.Session() as sess:
result,result2 = sess.run([mul_op,add_op])
print(result)
print(result2)
tf.train.SummaryWriter('./',sess.graph)
it shows message like this,
Tensor("Add:0", shape=(), dtype=int32)
However no file generated.
Upvotes: 0
Views: 79
Reputation: 222969
Here is a modified code, that should run:
import tensorflow as tf
const1 = tf.constant(2)
const2 = tf.constant(3)
add_op = tf.add(const1,const2)
mul_op = tf.multiply(add_op,const2) # probably you use old version of TF
with tf.Session() as sess:
writer = tf.summary.FileWriter('logs', sess.graph)
result,result2 = sess.run([mul_op,add_op])
writer.close()
I removed prints, change the name of the operation to be able to run it in the new version of TF (recommend to update) put the writer on top and closed it properly at the end. Also change the log dir.
Now from the same directory which you used to run a script run the following command: tensorboard --logdir=logs
. Navigate the browser and see the results.
Upvotes: 1