code: def applier(value, fn):
      if isinstance(value, torch.Tensor):
          return fn(value)
      elif isinstance(value, str):
          return value
      elif isinstance(value, np.ndarray):
          return value
      elif hasattr(
          value, "to"
      ):  # Allow handling of custom batch classes
          return fn(value)
      elif isinstance(value, container_abcs.Mapping):
          return {
              applier(k, fn): applier(v, fn) for k, v in value.items()
          }
      elif isinstance(value, container_abcs.Iterable):
          return type(value)(applier(v, fn) for v in value)
      else:
          # Do I want this to fire off even if someone chooses to pass something ordinary like
          # an int or float?  May be more annoying than it's worth.
          # print("Warning:  unrecognized type in applier.  If your input data is a custom class, "
          #     "provide it with a .to(dtype) method which converts its floating-point Tensors to dtype. "
          #     "Amp will check for your custom to() and invoke it to cast the batch's "
          #     "floating-point Tensors to the appropriate type. "
          #     "Also, if your data is a custom class, it is your responsibility to ensure that "
          #     "any Tensors you want to be cuda are already cuda."
          return value
  
imports: import collections.abc
  from types import MethodType
  import functools
  import sys
  import warnings
  import numpy
  import torch
  from ._amp_state import _amp_state, warn_or_err
  from .handle import disable_casts
  from .scaler import LossScaler
  from ._process_optimizer import _process_optimizer
  from apex.fp16_utils import convert_network
  from ..fp16_utils import FP16_Optimizer
  from ..contrib.optimizers import FP16_Optimizer
label_desc: Use image node_id 2 for calling a global function with example usage: applier(value, fn) and returns: fn, value, value, fn, unknown, type, value