code: def _update_properties(
      root: torch.nn.Module,
      device: Optional[torch.device] = None,
      dtype: Optional[Union[str, torch.dtype]] = None,
  ) -> None:
      def apply_fn(
          module: Union[_DeviceDtypeModuleMixin, Module]
      ) -> None:
          if not isinstance(module, _DeviceDtypeModuleMixin):
              return
          # cannot use `module.to()` because we don't actually want to move the model in case there are multiple
          # devices types (such as partial meta parameters)
          if device is not None:
              module._device = device
          if dtype is not None:
              module._dtype = dtype
  
      root.apply(apply_fn)
  
file_path: pytorch-lightning/src/lightning/fabric/utilities/device_dtype_mixin.py
imports: from typing import Any, List, Optional, Union
  import torch
  from torch.nn import Module
  from typing_extensions import Self, override
label_desc: Use image node_id 1 for calling a global function with example usage: _update_properties(root, device, dtype) without return types