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

Class CallbackToHook

tensorpack/callbacks/hooks.py:17–36  ·  view source on GitHub ↗

Hooks are less powerful than callbacks so the conversion is incomplete. It only converts the ``before_run/after_run`` calls. This is only for internal implementation of ``before_run/after_run`` callbacks. You shouldn't need to use this.

Source from the content-addressed store, hash-verified

15
16
17class CallbackToHook(tfv1.train.SessionRunHook):
18 """
19 Hooks are less powerful than callbacks so the conversion is incomplete.
20 It only converts the ``before_run/after_run`` calls.
21
22 This is only for internal implementation of
23 ``before_run/after_run`` callbacks.
24 You shouldn't need to use this.
25 """
26
27 def __init__(self, cb):
28 self._cb = cb
29
30 @HIDE_DOC
31 def before_run(self, ctx):
32 return self._cb.before_run(ctx)
33
34 @HIDE_DOC
35 def after_run(self, ctx, vals):
36 self._cb.after_run(ctx, vals)
37
38
39class HookToCallback(Callback):

Callers 2

_setup_graphMethod · 0.85
get_hooksMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected