class_docstr: Trainer extension to shift an optimizer attribute in "steps".
  
  This extension multiplies the specified attribute of the optimizer in
  "steps". The typical use case is to scale the attribute at every ``k``\ th
  iteration.
  
  For example, suppose that this extension is invoked at every iteration,
  then given ``k``, a multiplier ``gamma`` and an initial value
  ``init``, the optimizer attribute is set to
  ``init * gamma ^ (floor(i / k))``, where ``i`` represents the index of the
  current iteration.
  
  This extension is also called before the training loop starts by default.
  
  Args:
      attr (str): Name of the optimizer attribute to adjust.
      gamma (float): The multiplier.
      step (int): The interval for the multiplication, i.e., ``k``.
      init (float): Initial value of the attribute. If it is ``None``, the
          extension extracts the attribute at the first call and uses it as
          the initial value.
      target (float): Target value of the attribute. If the attribute reaches
          this value, the shift stops.
      optimizer (~chainer.Optimizer): Target optimizer object. If it is None,
          the main optimizer of the trainer is used.
class_docstr_tok: ["Trainer","extension","to","shift","an","optimizer","attribute","in","``","steps","''",".","This","extension","multiplies","the","specified","attribute","of","the","optimizer","in","''","steps","''",".","The","typical","use","case","is","to","scale","the","attribute","at","every","``","k","``","\\","th","iteration",".","For","example",",","suppose","that","this","extension","is","invoked","at","every","iteration",",","then","given","``","k","``",",","a","multiplier","``","gamma","``","and","an","initial","value","``","init","``",",","the","optimizer","attribute","is","set","to","``","init","*","gamma","^","(","floor","(","i","\/","k",")",")","``",",","where","``","i","``","represents","the","index","of","the","current","iteration",".","This","extension","is","also","called","before","the","training","loop","starts","by","default",".","Args",":","attr","(","str",")",":","Name","of","the","optimizer","attribute","to","adjust",".","gamma","(","float",")",":","The","multiplier",".","step","(","int",")",":","The","interval","for","the","multiplication",",","i.e.",",","``","k","``",".","init","(","float",")",":","Initial","value","of","the","attribute",".","If","it","is","``","None","``",",","the","extension","extracts","the","attribute","at","the","first","call","and","uses","it","as","the","initial","value",".","target","(","float",")",":","Target","value","of","the","attribute",".","If","the","attribute","reaches","this","value",",","the","shift","stops",".","optimizer","(","~chainer.Optimizer",")",":","Target","optimizer","object",".","If","it","is","None",",","the","main","optimizer","of","the","trainer","is","used","."]
code: def __call__(self, trainer):
      self._t += 1
      optimizer = self._get_optimizer(trainer)
      value = self._init * self._gamma ** numpy.floor(
          self._t / self._step
      )
      if self._target is not None:
          if self._gamma > 1:
              # almost same as value = min(value, self._target), but this
              # line supports negative values, too
              if value / self._target > 1:
                  value = self._target
          else:
              # ditto
              if value / self._target < 1:
                  value = self._target
      self._update_value(optimizer, value)
  
file_path: chainer/chainer/training/extensions/step_shift.py
imports: from __future__ import division
  import numpy
  from chainer.training import extension
label_desc: Use image node_id 3 for calling the StepShift obj's underlying member method code with example usage: obj.__call__(trainer) without return types