Return true if the timer should trigger for the specified step.
Args
step
Training step to trigger on.
Returns
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.
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.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.estimator.SecondOrStepTimer\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/training/basic_session_run_hooks.py#L85-L150) |\n\nTimer that triggers at most once every N seconds or once every N steps. (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.estimator.SecondOrStepTimer`](https://www.tensorflow.org/api_docs/python/tf/estimator/SecondOrStepTimer), [`tf.compat.v1.train.SecondOrStepTimer`](https://www.tensorflow.org/api_docs/python/tf/estimator/SecondOrStepTimer)\n\n\u003cbr /\u003e\n\n tf.estimator.SecondOrStepTimer(\n every_secs=None, every_steps=None\n )\n\n| **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.keras instead.\n\nThis symbol is also exported to v2 in tf.estimator namespace. See\n\u003chttps://github.com/tensorflow/estimator/blob/master/tensorflow_estimator/python/estimator/hooks/basic_session_run_hooks.py\u003e\n\nMethods\n-------\n\n### `last_triggered_step`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/training/basic_session_run_hooks.py#L149-L150) \n\n last_triggered_step()\n\nReturns the last triggered time step or None if never triggered.\n\n### `reset`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/training/basic_session_run_hooks.py#L105-L107) \n\n reset()\n\nResets the timer.\n\n### `should_trigger_for_step`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/training/basic_session_run_hooks.py#L109-L134) \n\n should_trigger_for_step(\n step\n )\n\nReturn true if the timer should trigger for the specified step.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------|------------------------------|\n| `step` | Training step to trigger on. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| 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. ||\n\n\u003cbr /\u003e\n\n### `update_last_triggered_step`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/training/basic_session_run_hooks.py#L136-L147) \n\n update_last_triggered_step(\n step\n )\n\nUpdate the last triggered time and step number.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------|-------------------|\n| `step` | The current step. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| 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. ||\n\n\u003cbr /\u003e"]]