MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

tensorflow/contrib/distribute/python/monitor.py:36–56  ·  view source on GitHub ↗

Initialize the Monitor with components for executing training steps. Args: step_callable: a training `Step` that's capable of signaling when done. session: a `Session` instance that's needed for graph mode. Raises: ValueError: if `session` was provided for eager mode or n

(self, step_callable, session=None)

Source from the content-addressed store, hash-verified

34 # TODO(isaprykin): Support recovery, checkpointing and summaries.
35
36 def __init__(self, step_callable, session=None):
37 """Initialize the Monitor with components for executing training steps.
38
39 Args:
40 step_callable: a training `Step` that's capable of signaling when done.
41 session: a `Session` instance that's needed for graph mode.
42
43 Raises:
44 ValueError: if `session` was provided for eager mode or not provided for
45 graph mode.
46 """
47 if context.executing_eagerly():
48 if session is not None:
49 raise ValueError("Should not provide a `session` in Eager mode.")
50 self._run_step = step_callable
51 else:
52 if session is None:
53 raise ValueError("Should provide a `session` in Graph mode.")
54 session.run(step_callable.initialize())
55 self._run_step = session.make_callable(step_callable())
56 session.run(variables.global_variables_initializer())
57
58 def run_steps(self, num_steps=None):
59 step = 0

Callers

nothing calls this directly

Calls 4

executing_eagerlyMethod · 0.80
initializeMethod · 0.65
runMethod · 0.45
make_callableMethod · 0.45

Tested by

no test coverage detected