Skip to content

Instantly share code, notes, and snippets.

@peterroelants
Created August 24, 2017 11:56
Show Gist options
  • Save peterroelants/529eeb77c83eef4238b15365c5d680db to your computer and use it in GitHub Desktop.
Save peterroelants/529eeb77c83eef4238b15365c5d680db to your computer and use it in GitHub Desktop.
Iterator Initializer Hook
class IteratorInitializerHook(tf.train.SessionRunHook):
"""Hook to initialise data iterator after Session is created."""
def __init__(self):
super(IteratorInitializerHook, self).__init__()
self.iterator_initializer_func = None
def after_create_session(self, session, coord):
"""Initialise the iterator after the session has been created."""
self.iterator_initializer_func(session)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment