class_docstr: Trainer extension to shift an optimizer attribute magically by Vaswani.
  
  Args:
      attr (str): Name of the attribute to shift.
      rate (float): Rate of the exponential shift. This value is multiplied
          to the attribute at each call.
      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 to adjust the
          attribute. If it is ``None``, the main optimizer of the updater is
          used.
docstr: Initialize Vaswani rule extension.
docstr_tok: ["Initialize","Vaswani","rule","extension","."]
code: def __init__(
      self,
      attr,
      d,
      warmup_steps=4000,
      init=None,
      target=None,
      optimizer=None,
      scale=1.0,
  ):
      """Initialize Vaswani rule extension."""
      self._attr = attr
      self._d_inv05 = d ** (-0.5) * scale
      self._warmup_steps_inv15 = warmup_steps ** (-1.5)
      self._init = init
      self._target = target
      self._optimizer = optimizer
      self._t = 0
      self._last_value = None
  
imports: import collections
  import logging
  import math
  import numpy
  from chainer import cuda
  from chainer import functions
  from chainer import training
  from chainer.training import extension
  from chainer.training.updaters.multiprocess_parallel_updater import gather_grads, gather_params, scatter_grads
label_desc: Use image node_id 1 to create a new VaswaniRule object from inherited base classes: extension with example: obj = VaswaniRule(attr, d, warmup_steps, init, target, optimizer, scale)