code: def invert_gradients(x, range_min, range_max):
      """Inverts gradients of values exceeding a given range.
  
      See: http://arxiv.org/abs/1511.04143
  
      Args:
          x (chainer.Variable or ndarray): Input value.
          range_min (chainer.Variable or ndarray): Minimum of the value range.
          range_max (chainer.Variable or ndarray): Maximum of the value range.
      Returns:
          The same value as x, except that the gradients backpropagated is scaled
          and inverted so that values would be in a given range after update.
      """
      xp = cuda.get_array_module(x, x.array)
      return InvertGradients(
          xp.asarray(range_min), xp.asarray(range_max)
      )(x)
  
file_path: chainerrl/chainerrl/functions/invert_gradients.py
imports: from chainer import cuda
  from chainer import function
  from chainer.utils import type_check
label_desc: Use image node_id 1 for calling a global function with example usage: invert_gradients(x, range_min, range_max) and returns: InvertGradients