MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / initialize_hooks

Method initialize_hooks

tensorpack/train/base.py:244–253  ·  view source on GitHub ↗

Create SessionRunHooks for all callbacks, and hook it onto `self.sess` to create `self.hooked_sess`. A new trainer may override this method to create multiple groups of hooks, which can be useful when the training is not done by a single `train_op`.

(self)

Source from the content-addressed store, hash-verified

242
243 @call_only_once
244 def initialize_hooks(self):
245 """
246 Create SessionRunHooks for all callbacks, and hook it onto `self.sess` to create `self.hooked_sess`.
247
248 A new trainer may override this method to create multiple groups of hooks,
249 which can be useful when the training is not done by a single `train_op`.
250 """
251 hooks = self._callbacks.get_hooks()
252 self.hooked_sess = tfv1.train.MonitoredSession(
253 session_creator=ReuseSessionCreator(self.sess), hooks=hooks)
254
255 @call_only_once
256 def main_loop(self, steps_per_epoch, starting_epoch, max_epoch):

Callers 1

initializeMethod · 0.95

Calls 2

ReuseSessionCreatorClass · 0.85
get_hooksMethod · 0.80

Tested by

no test coverage detected