code: def _cast_float(args, dtype: torch.dtype):
      if isinstance(args, torch.Tensor) and torch.is_floating_point(
          args
      ):
          args = args.to(dtype)
      elif isinstance(args, (list, tuple)):
          args = type(args)(_cast_float(t, dtype) for t in args)
      elif isinstance(args, dict):
          args = {k: _cast_float(v, dtype) for k, v in args.items()}
      return args
  
imports: from collections import OrderedDict
  from functools import partial
  from typing import Iterable, Optional, Set
  import torch
  import torch.distributed
  from colossalai.legacy.tensor import ProcessGroup
  from colossalai.utils import is_ddp_ignored
  from .reducer import Reducer
label_desc: Use image node_id 2 for calling a global function with example usage: _cast_float(args, dtype) and returns: args