Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using tensorboard, how to summarize a loss that is computed over several minibatches?

I would like to use Tensorboard to visualize the evolution of the loss over a validation sample. But the validation set is too large to compute in one minibatch. Therefore, to compute my validation loss, I have to call session.run several times over several minibatches covering the validation set. Then I sum the loss (in python) of each minibatches to obtain the full validation loss.

My problem is that tf.scalar_summary seems to have to be attached to a tensorflow node. But I would need to somehow "attach" it to the sum of the values of a node over several run of session.run.

Is there a way to do that? Maybe by directly summarizing the python float that contains the sum of the minibatch losses? But I have not seen in the docs a way to "summarize" for tensorboard a python value that is outside of a computation. The example in the "How-To" section of the doc is only concerned with losses that can be computed in a single call to session.run.

like image 417
Fabien C. Avatar asked Dec 15 '15 07:12

Fabien C.


1 Answers

You could add a Variable that is updated on each sess.Run call and have the summary track the value of the Variable.

like image 96
Ian Goodfellow Avatar answered Sep 28 '22 05:09

Ian Goodfellow