code: def test_fabric_module_device_dtype_propagation(device_str, dtype):
      """Test that the FabricModule propagates device and dtype properties to its submodules (e.g. torchmetrics)."""
      device = torch.device(device_str)
  
      class DeviceModule(_DeviceDtypeModuleMixin):
          pass
  
      device_module = DeviceModule()
      fabric_module = _FabricModule(device_module, Mock())
      fabric_module.to(device)
      assert device_module.device == device
      assert fabric_module.device == device
  
      fabric_module.to(dtype)
      assert device_module.dtype == dtype
      assert fabric_module.dtype == dtype
  
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric.fabric import Fabric
  from lightning.fabric.plugins import Precision
  from lightning.fabric.utilities.device_dtype_mixin import _DeviceDtypeModuleMixin
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from lightning.fabric.wrappers import _FabricDataLoader, _FabricModule, _FabricOptimizer, _unwrap_objects, is_wrapped
  from torch.utils.data import BatchSampler, DistributedSampler
  from torch.utils.data.dataloader import DataLoader
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 7 for calling a global function with example usage: test_fabric_module_device_dtype_propagation(device_str, dtype) without return types