Type SecondOrStepTimer
Namespace tensorflow.train
Parent _HookTimer
Interfaces ISecondOrStepTimer
Timer that triggers at most once every N seconds or once every N steps. This symbol is also exported to v2 in tf.estimator namespace. See
https://github.com/tensorflow/estimator/blob/master/tensorflow_estimator/python/estimator/hooks/basic_session_run_hooks.py
Methods
- last_triggered_step
- last_triggered_step_dyn
- should_trigger_for_step
- should_trigger_for_step_dyn
- update_last_triggered_step
- update_last_triggered_step_dyn
Properties
Public instance methods
Nullable<int> last_triggered_step()
Returns the last triggered time step or None if never triggered.
object last_triggered_step_dyn()
Returns the last triggered time step or None if never triggered.
bool should_trigger_for_step(Nullable<int> step)
Return true if the timer should trigger for the specified step.
Parameters
-
Nullable<int>
step - Training step to trigger on.
Returns
-
bool
- True if the difference between the current time and the time of the last trigger exceeds `every_secs`, or if the difference between the current step and the last triggered step exceeds `every_steps`. False otherwise.
object should_trigger_for_step_dyn(object step)
Return true if the timer should trigger for the specified step.
Parameters
-
object
step - Training step to trigger on.
Returns
-
object
- True if the difference between the current time and the time of the last trigger exceeds `every_secs`, or if the difference between the current step and the last triggered step exceeds `every_steps`. False otherwise.
ValueTuple<Nullable<double>, object> update_last_triggered_step(int step)
Update the last triggered time and step number.
Parameters
-
int
step - The current step.
Returns
-
ValueTuple<Nullable<double>, object>
- A pair `(elapsed_time, elapsed_steps)`, where `elapsed_time` is the number of seconds between the current trigger and the last one (a float), and `elapsed_steps` is the number of steps between the current trigger and the last one. Both values will be set to `None` on the first trigger.
object update_last_triggered_step_dyn(object step)
Update the last triggered time and step number.
Parameters
-
object
step - The current step.
Returns
-
object
- A pair `(elapsed_time, elapsed_steps)`, where `elapsed_time` is the number of seconds between the current trigger and the last one (a float), and `elapsed_steps` is the number of steps between the current trigger and the last one. Both values will be set to `None` on the first trigger.