code: def cast_all(x, from_dtype=torch.float16, to_dtype=torch.float32):
      if isinstance(x, torch.Tensor):
          return cast_tensor(
              x, from_dtype=from_dtype, to_dtype=to_dtype
          )
      else:
          if isinstance(x, dict):
              new_dict = {}
              for k in x.keys():
                  new_dict[k] = cast_all(
                      x[k], from_dtype=from_dtype, to_dtype=to_dtype
                  )
              return new_dict
          elif isinstance(x, tuple):
              return tuple(
                  cast_all(y, from_dtype=from_dtype, to_dtype=to_dtype)
                  for y in x
              )
  
file_path: NeMo/nemo/utils/cast_utils.py
imports: from contextlib import nullcontext
  import torch
label_desc: Use image node_id 4 for calling a global function with example usage: cast_all(x, from_dtype, to_dtype) and returns: cast_tensor, new_dict, tuple