Skip to content Skip to sidebar Skip to footer

Tensorflow Dataset Api Doubles Graph Protobuff Filesize

Summary: Using the new tf.contrib.data.Dataset doubles the size of my graph protobuff file and I'm unable to visualize the graph in Tensorboard. The details: I'm trying out the new

Solution 1:

I found a solution to my problem using tf.train.SessionRunHook. I create a SessionRunHook object that initialises the iterator after the session is created:

classIteratorInitializerHook(tf.train.SessionRunHook):def__init__(self):
        super(IteratorInitializerHook, self).__init__()
        self.iterator_initiliser_func = None

    defafter_create_session(self, session, coord):
        self.iterator_initiliser_func(session)

The initializer function is set when creating the Dataset Iterator:

iterator_initiliser_hook.iterator_initiliser_func=\lambda sess:sess.run(iterator.initializer,feed_dict={images_placeholder:images,labels_placeholder:labels})

And I pass in the hook objects to train_monitors and eval_hooks parameters of tf.contrib.learn.Experiment.

The resulting graph.pbtxt file is now only 500K while the .meta files are only 244K.

Full example here.

Post a Comment for "Tensorflow Dataset Api Doubles Graph Protobuff Filesize"