code: def _wrap_loss_output_functions(module, ls, target_dtype):
      if module == ndarray:
  
          def _wrapper(f):
              def _scaling_wrapper(*args, **kwargs):
                  if "grad_scale" in kwargs:
                      kwargs["grad_scale"] = (
                          kwargs["grad_scale"] * ls.loss_scale
                      )
                  else:
                      kwargs["grad_scale"] = ls.loss_scale
                  return f(*args, **kwargs)
  
              _scaling_wrapper.__name__ = f.__name__
              _scaling_wrapper.__module__ = f.__module__
              _scaling_wrapper.__doc__ = f.__doc__
              return _scaling_wrapper
  
      else:
  
          def _wrapper(f):
              def _warning_wrapper(*args, **kwargs):
                  logging.warning(
                      "%s does not support dynamic loss scaling "
                      "in symbolic and hybridized execution.",
                      f.__name__,
                  )
                  return f(*args, **kwargs)
  
              _warning_wrapper.__name__ = f.__name__
              _warning_wrapper.__module__ = f.__module__
              _warning_wrapper.__doc__ = f.__doc__
              return _warning_wrapper
  
      for fun_name in list_loss_output_functions(target_dtype):
          try:
              f_to_wrap = getattr(module, fun_name)
              setattr(module, fun_name, _wrapper(f_to_wrap))
          except AttributeError:
              pass
  
imports: from array import array
  import ctypes
  import inspect
  import logging
  import contextlib
  import sys
  import numpy
  from mxnet import numpy
  from ..None import symbol
  from ..device import gpu
  from ..symbol import Symbol
  from ..symbol import contrib
  from ..None import ndarray
  from ..ndarray import NDArray, dtype_np_to_mx, get_dtype_type, get_dtype_name, bfloat16
  from .None import lists
  from ..gluon import Block, HybridBlock, trainer
  from ..None import base
  from ..base import _NP_OP_PREFIX, _NP_OP_SUBMODULE_LIST, _NP_EXT_OP_PREFIX, _NP_EXT_OP_SUBMODULE_LIST, _NP_INTERNAL_OP_PREFIX, c_str_array, c_str, c_array_buf, SymbolHandle, check_call, _LIB
  from ..None import optimizer
  from .loss_scaler import LossScaler
  from ..operator import get_all_registered_operators_grouped
  from ..util import wrap_ctx_to_device_func
label_desc: Use image node_id 5 for calling a global function with example usage: _wrap_loss_output_functions(module, ls, target_dtype) and returns: _scaling_wrapper, _warning_wrapper, f, f