edward
edward copied to clipboard
Inference not showing up in TensorBoard
Hi, the various inference-related objects created by edward don't show up in tensorboard after I reset the default graph & session.
A typical workflow is that I experiment with a model by repeatedly calling
tf.reset_default_graph() and tf.InteractiveSession() between two model iterations (I don't want to restart the kernel every time). Each iteration I run inference with the logdir=... option to output the graph.
In tensorboard it looks like the graph only contains the objects up to but excluding the inference step. On the other hand, tf.graph_def shows all inference-related objects so the problem seems to be with edward's output to tensorboard.
The attached tensorboard screenshot illustrates the problem. It's the output of the linked notebook.

Btw, thanks for creating Edward! Looking forward to 2.0.
Have you uncollapsed the iteration cell? IIRC it should be within iteration's scope. (At the least, it must exist somewhere in the graph.)
It's not in iteration or any of the other cells (uncollapsed qx not shown because it didn't fit on screen):

Oh, I see. From that screenshot, it looks like inference appears across various places in the graph: iteration, the stack ops, strided slice, etc. None of those appear in your model?
To be explicit, try:
with tf.name_scope("inference"):
inference = ed.KLqp({x: qx})
inference.run(logdir=r'C:\tmp\log')
This will put all inference-built graph ops in the highest-level name scope.
That did it. Thanks.
Browsing through the code I guess my issue was that the default graph is written in Inference.initialize(), which is called from VariationalInference.initialize() before any optimizer or KLqp specific nodes are added to the graph. Is the graph written that early on purpose?