Last active
June 10, 2018 04:48
-
-
Save amobiny/557e6c8a3fe0dc954cd9a7d26c6661e5 to your computer and use it in GitHub Desktop.
Revisions
-
amobiny revised this gist
Jun 10, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,5 +16,4 @@ summary = sess.run(first_summary) # ____step 4:____ add the summary to the writer (i.e. to the event file) writer.add_summary(summary, step) print('Done with writing the scalar summary') -
amobiny revised this gist
Jun 10, 2018 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,5 +17,4 @@ # ____step 4:____ add the summary to the writer (i.e. to the event file) writer.add_summary(summary, step) print('Done with writing the scalar summary')
-
amobiny created this gist
Jun 10, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import tensorflow as tf tf.reset_default_graph() # To clear the defined variables and operations of the previous cell # create the scalar variable x_scalar = tf.get_variable('x_scalar', shape=[], initializer=tf.truncated_normal_initializer(mean=0, stddev=1)) # ____step 1:____ create the scalar summary first_summary = tf.summary.scalar(name='My_first_scalar_summary', tensor=x_scalar) init = tf.global_variables_initializer() # launch the graph in a session with tf.Session() as sess: # ____step 2:____ creating the writer inside the session writer = tf.summary.FileWriter('./graphs', sess.graph) for step in range(100): # loop over several initializations of the variable sess.run(init) # ____step 3:____ evaluate the scalar summary summary = sess.run(first_summary) # ____step 4:____ add the summary to the writer (i.e. to the event file) writer.add_summary(summary, step) print('Done with writing the scalar summary') Done with writing the scalar summary