Creating summary

We can also visualize how the loss and accuracy of our model changes during several iterations in TensorBoard. So, we use tf.summary() to get the summary of the variable. Since the loss and accuracy are scalar variables, we use tf.summary.scalar(), as shown in the following code:

tf.summary.scalar("Accuracy", accuracy)
tf.summary.scalar("Loss", loss)

Next, we merge all of the summaries we use in our graph, using tf.summary.merge_all(). We do this because when we have many summaries, running and storing them would become inefficient, so we run them once in our session instead of running multiple times:

merge_summary = tf.summary.merge_all()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset