code: def _decorator_helper(orig_fn, cast_fn, wrap_fn):
      def wrapper(*args, **kwargs):
          handle = _DECORATOR_HANDLE
          if handle is None or not handle.is_active():
              return orig_fn(*args, **kwargs)
          inner_cast_fn = utils.verbosify(
              cast_fn, orig_fn.__name__, handle.verbose
          )
          return wrap_fn(orig_fn, inner_cast_fn, handle)(
              *args, **kwargs
          )
  
      return wrapper
  
file_path: apex/apex/amp/amp.py
imports: import functools
  import itertools
  import torch
  from .None import compat, rnn_compat, utils, wrap
  from .handle import AmpHandle, NoOpHandle
  from .lists import functional_overrides, torch_overrides, tensor_overrides
  from ._amp_state import _amp_state
  from .frontend import *
label_desc: Use image node_id 1 for calling a global function with example usage: _decorator_helper(orig_fn, cast_fn, wrap_fn) and returns: wrapper, wrap_fn, orig_fn