class_docstr: Implements a cyclical decay used internally in PowerSign and AddSign optimizers.
  
  It has been proposed in `Neural Optimizer Search with Reinforcement Learning`_.
  
  Arguments:
      T_max (int): the total number of training steps
          to be used to compute internal decays
      num_periods: number of periods of cosine from 0 to T_max (default: 0.5)
      zero_after: if not None, number after which 0 is returned
  
  .. _Neural Optimizer Search with Reinforcement Learning:
      https://arxiv.org/abs/1709.07417
docstr: Returns a cyclical decay at the current training step:
      0.5 * (1 + cos(2 * pi * num_periods * step / T_max))
  
  Args:
    step: the current training step.
docstr_tok: ["Returns","a","cyclical","decay","at","the","current","training","step",":","0.5","*","(","1","+","cos","(","2","*","pi","*","num_periods","*","step","\/","T_max",")",")","Args",":","step",":","the","current","training","step","."]
code: def __call__(self, step):
      """Returns a cyclical decay at the current training step:
          0.5 * (1 + cos(2 * pi * num_periods * step / T_max))
  
      Args:
        step: the current training step.
      """
      if step is None:
          raise ValueError("step is required for cosine_decay.")
      if step < 0:
          raise ValueError("step should be >= 0.")
      step = min(step, self.T_max)
      frac = 2.0 * self.num_periods * step / float(self.T_max)
      if self.zero_after is not None and frac >= 2 * self.zero_after:
          return 0.0
      decay = 0.5 * (1 + math.cos(math.pi * frac))
      return decay
  
file_path: pywick/pywick/optimizers/sign_internal_decay.py
imports: import math
label_desc: Use image node_id 2 for calling the CosineInternalDecay obj's underlying member method code with example usage: obj.__call__(step) and returns: decay, int