class_docstr: Scale certain gradient by a multiplier.
class_docstr_tok: ["Scale","certain","gradient","by","a","multiplier","."]
docstr: Args:
      multipliers (tuple or list): tuple of (regex, float), or list of such tuples.
      verbose (bool): whether to print logs or not
  
  Example:
      Use double learning rate for all the bias (as in caffe), and freeze layer0:
  
      .. code-block:: python
  
          from tensorpack.tfutils import optimizer, gradproc
          opt = optimizer.apply_grad_processors(
              opt, [gradproc.ScaleGradient(
                  [('.*/b', 2.), ('layer0/.*', 0.)]
              )])
docstr_tok: ["Args",":","multipliers","(","tuple","or","list",")",":","tuple","of","(","regex",",","float",")",",","or","list","of","such","tuples",".","verbose","(","bool",")",":","whether","to","print","logs","or","not","Example",":","Use","double","learning","rate","for","all","the","bias","(","as","in","caffe",")",",","and","freeze","layer0",":","..","code-block",":",":","python","from","tensorpack.tfutils","import","optimizer",",","gradproc","opt","=","optimizer.apply_grad_processors","(","opt",",","[","gradproc.ScaleGradient","(","[","(","'",".","*","\/b","'",",","2",".",")",",","(","'layer0\/",".","*","'",",","0",".",")","]",")","]",")"]
code: def __init__(self, multipliers, verbose=True):
      """
      Args:
          multipliers (tuple or list): tuple of (regex, float), or list of such tuples.
          verbose (bool): whether to print logs or not
  
      Example:
          Use double learning rate for all the bias (as in caffe), and freeze layer0:
  
          .. code-block:: python
  
              from tensorpack.tfutils import optimizer, gradproc
              opt = optimizer.apply_grad_processors(
                  opt, [gradproc.ScaleGradient(
                      [('.*/b', 2.), ('layer0/.*', 0.)]
                  )])
      """
      if not isinstance(multipliers, list):
          multipliers = [multipliers]
      self.multipliers = multipliers
      assert verbose in [True, False], verbose
      self._verbose = verbose
      super(ScaleGradient, self).__init__(self._mapper)
  
imports: import inspect
  import re
  from abc import ABCMeta, abstractmethod
  import six
  import tensorflow
  from ..compat import tfv1
  from ..utils import logger
  from .summary import add_moving_summary
  from .symbolic_functions import print_stat, rms
label_desc: Use image node_id 1 to create a new ScaleGradient object from inherited base classes: MapGradient with example: obj = ScaleGradient(multipliers, verbose)