class_docstr: Apply a function on all gradient if the name matches regex.
  Keep the other gradients unchanged.
  
  It can be used for gradient clipping, etc.
class_docstr_tok: ["Apply","a","function","on","all","gradient","if","the","name","matches","regex",".","Keep","the","other","gradients","unchanged",".","It","can","be","used","for","gradient","clipping",",","etc","."]
code: def _process(self, grads):
      ret = []
      matched = False
      for grad, var in grads:
          if re.match(self.regex, var.op.name):
              matched = True
              grad = self.func(grad, var)
              if grad is not None:
                  ret.append((grad, var))
          else:
              ret.append((grad, var))
      if not matched:
          logger.warn(
              "[MapGradient] No match was found for regex {}.".format(
                  self.regex
              )
          )
      return ret
  
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 2 for calling the MapGradient obj's underlying member method code with example usage: obj._process(grads) and returns: ret