class_docstr: Trigger a callback every k global steps or every k epochs by its :meth:`trigger()` method.
  
  Most existing callbacks which do something every epoch are implemented
  with :meth:`trigger()` method. By default the :meth:`trigger()` method will be called every epoch.
  This wrapper can make the callback run at a different frequency.
  
  All other methods (``before/after_run``, ``trigger_step``, etc) of the given callback
  are unaffected. They will still be called as-is.
docstr: Args:
      triggerable (Callback): a Callback instance with a trigger method to be called.
      every_k_steps (int): trigger when ``global_step % k == 0``. Set to
          None to ignore.
      every_k_epochs (int): trigger when ``epoch_num % k == 0``. Set to
          None to ignore.
      before_train (bool): trigger in the :meth:`before_train` method.
  
  every_k_steps and every_k_epochs can be both set, but cannot be both None unless before_train is True.
docstr_tok: ["Args",":","triggerable","(","Callback",")",":","a","Callback","instance","with","a","trigger","method","to","be","called",".","every_k_steps","(","int",")",":","trigger","when","``","global_step","%","k","==","0","``",".","Set","to","None","to","ignore",".","every_k_epochs","(","int",")",":","trigger","when","``","epoch_num","%","k","==","0","``",".","Set","to","None","to","ignore",".","before_train","(","bool",")",":","trigger","in","the",":","meth",":","`","before_train","`","method",".","every_k_steps","and","every_k_epochs","can","be","both","set",",","but","can","not","be","both","None","unless","before_train","is","True","."]
code: def __init__(
      self,
      triggerable,
      every_k_steps=None,
      every_k_epochs=None,
      before_train=False,
  ):
      """
      Args:
          triggerable (Callback): a Callback instance with a trigger method to be called.
          every_k_steps (int): trigger when ``global_step % k == 0``. Set to
              None to ignore.
          every_k_epochs (int): trigger when ``epoch_num % k == 0``. Set to
              None to ignore.
          before_train (bool): trigger in the :meth:`before_train` method.
  
      every_k_steps and every_k_epochs can be both set, but cannot be both None unless before_train is True.
      """
      assert isinstance(triggerable, Callback), type(triggerable)
      super(PeriodicTrigger, self).__init__(triggerable)
      if before_train is False:
          assert (every_k_epochs is not None) or (
              every_k_steps is not None
          ), "Arguments to PeriodicTrigger have disabled the triggerable!"
      self._step_k = every_k_steps
      self._epoch_k = every_k_epochs
      self._do_before_train = before_train
  
imports: from .base import Callback, ProxyCallback
label_desc: Use image node_id 1 to create a new PeriodicTrigger object from inherited base classes: ProxyCallback with example: obj = PeriodicTrigger(triggerable, every_k_steps, every_k_epochs, before_train)