code: def init(
      target_dtype="float16",
      target_precision_ops=None,
      conditional_fp32_ops=None,
      fp32_ops=None,
      layout_optimization=False,
  ):
      """Initialize AMP (automatic mixed precision).
  
      This needs to be done before model creation.
  
      Parameters
      ----------
      target_dtype : {'float16', 'bfloat16'}
          Target low precision type for AMP. Currently only float16 and bfloat16 are supported.
      target_precision_ops : list of string
          Override the list of functions casted to target_dtype. Entries in this list
          are names of the functions casted to target_dtype.
      conditional_fp32_ops : list of (string, string, list of string)
          Override the list of functions conditionally casted to FP32. The format
          of the list is (name of the function, name of the parameter, list of
          values of the parameter that make the function be casted to FP32).
      fp32_ops : list of string
          Override the list of functions casted to FP32. Entries in this list
          are names of the functions casted to FP32.
      """
      global _amp_initialized
      global _loss_scaler
      if not _amp_initialized:
          assert target_dtype in [
              "float16",
              np.float16,
              "bfloat16",
              bfloat16,
          ], "AMP currently supports only float16 or bfloat16 as a target_dtype"
          _amp_initialized = True
          log_msg = "Using AMP"
          if layout_optimization:
              log_msg += "\n - layout optimization: enabled"
              check_call(_LIB.MXSetOptimizeLayout(ctypes.c_bool(True)))
          logging.info(log_msg)
          if target_dtype == "bfloat16":
              target_dtype = bfloat16
          else:
              target_dtype = np.dtype(target_dtype)
  
          warn_if_model_exists()
  
          ops = get_all_registered_operators_grouped()
          get_aliases_nd = lambda l: [
              a for op in l for a in ops[op] if not base._is_np_op(a)
          ]
          get_aliases_np = lambda l: [
              a for op in l for a in ops[op] if base._is_np_op(a)
          ]
          get_aliases_np_pub = lambda l: [
              a
              for op in l
              for a in ops[op]
              if a.startswith(("_np_", "_npx_"))
          ]
          get_cond_aliases_nd = lambda l: [
              (a, *rest)
              for op, *rest in l
              for a in ops[op]
              if not base._is_np_op(a)
          ]
          get_cond_aliases_np = lambda l: [
              (a, *rest)
              for op, *rest in l
              for a in ops[op]
              if base._is_np_op(a)
          ]
          get_cond_aliases_np_pub = lambda l: [
              (a, *rest)
              for op, *rest in l
              for a in ops[op]
              if a.startswith(("_np_", "_npx_"))
          ]
          sy_submodules = {
              p: getattr(symbol, p[1:-1])
              for p in base._OP_NAME_PREFIX_LIST
          }
          get_sy_fun = lambda fun, mod: _get_nd_fun_to_wrap(
              fun, mod, sy_submodules
          )
          nd_submodules = {
              p: getattr(ndarray, p[1:-1])
              for p in base._OP_NAME_PREFIX_LIST
          }
          get_nd_fun = lambda fun, mod: _get_nd_fun_to_wrap(
              fun, mod, nd_submodules
          )
          get_np_sy_fun = lambda fun, mod: _get_np_fun_to_wrap(
              fun, "mxnet.symbol"
          )
          get_np_nd_fun = lambda fun, mod: _get_np_fun_to_wrap(
              fun, "mxnet.ndarray"
          )
          get_np_fun = lambda fun, mode: _get_np_fun_to_wrap(
              fun, "mxnet"
          )
          todo = [
              (
                  symbol,
                  False,
                  get_aliases_nd,
                  get_cond_aliases_nd,
                  get_sy_fun,
              ),
              (
                  ndarray,
                  False,
                  get_aliases_nd,
                  get_cond_aliases_nd,
                  get_nd_fun,
              ),
              (
                  symbol.numpy,
                  True,
                  get_aliases_np,
                  get_cond_aliases_np,
                  get_np_sy_fun,
              ),
              (
                  ndarray.numpy,
                  True,
                  get_aliases_np,
                  get_cond_aliases_np,
                  get_np_nd_fun,
              ),
              (
                  numpy,
                  True,
                  get_aliases_np_pub,
                  get_cond_aliases_np_pub,
                  get_np_fun,
              ),
          ]
          _loss_scaler = LossScaler()
          for (
              module,
              is_numpy,
              get_aliases,
              get_cond_aliases,
              get_fun,
          ) in todo:
              _wrap_module_functions(
                  module,
                  is_numpy,
                  target_dtype,
                  get_aliases,
                  get_cond_aliases,
                  get_fun,
                  target_precision_ops,
                  conditional_fp32_ops,
                  fp32_ops,
              )
              _wrap_loss_output_functions(
                  module, _loss_scaler, target_dtype
              )
  
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 8 for calling a global function with example usage: init(target_dtype, target_precision_ops, conditional_fp32_ops, fp32_ops, layout_optimization) without return types