Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import tensorflow as tf
  2. import numpy as np
  3.  
  4. x = tf.Variable(0, dtype=tf.float32)
  5. tf.summary.scalar("X", x)
  6.  
  7. init = tf.global_variables_initializer()
  8. with tf.Session() as sess:
  9.     writer = tf.summary.FileWriter('./logs', sess.graph)
  10.     sess.run(init)
  11.     for i in range(1, 11):
  12.         merge = tf.summary.merge_all()
  13.         x = tf.add(x, 1)
  14.        
  15.         summary, x = sess.run([merge, x])
  16.        
  17.         writer.add_summary(summary, i)
  18.     print("X = ", x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement