code: def _init_with_reset_params(module: nn.Module):
      """
      to_empty + reset_parameters() init function example for modules
      initialized with device="meta"
      """
      has_meta_states = any(
          t.is_meta
          for t in itertools.chain(
              module.parameters(recurse=False),
              module.buffers(recurse=False),
          )
      )
      if has_meta_states:
          device = torch.device("cuda", torch.cuda.current_device())
          module.to_empty(device=device, recurse=False)
          module.reset_parameters()
  
imports: import itertools
  import sys
  from typing import Union
  import torch
  import torch.distributed
  import torch.nn
  from torch.distributed.fsdp import FullyShardedDataParallel, MixedPrecision
  from torch.distributed.fsdp.wrap import always_wrap_policy, enable_wrap, ModuleWrapPolicy, wrap
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import FSDPTest
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, skip_but_pass_in_sandcastle_if, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 2 for calling a global function with example usage: _init_with_reset_params(module) without return types