code: def remap_variables(fn):
      """
      Use fn to map the output of any variable getter.
  
      Args:
          fn (tf.Variable -> tf.Tensor)
  
      Returns:
          The current variable scope with a custom_getter that maps
          all the variables by fn.
  
      Example:
          .. code-block:: python
  
              from tensorpack.tfutils import varreplace
              with varreplace.remap_variables(lambda var: quantize(var)):
                  x = FullyConnected('fc', x, 1000)   # fc/{W,b} will be quantized
      """
  
      def custom_getter(getter, *args, **kwargs):
          v = getter(*args, **kwargs)
          return fn(v)
  
      return custom_getter_scope(custom_getter)
  
imports: from contextlib import contextmanager
  from ..utils import logger
  from ..compat import tfv1
  from .common import get_tf_version_tuple
label_desc: Use image node_id 2 for calling a global function with example usage: remap_variables(fn) and returns: custom_getter_scope, fn