code: def _reset_params_if_meta(is_meta: bool, model: nn.Module):
      # For torchdistX init, we don't need to call reset_params, as
      # deferred_init(model).materialize() is equivalent to model().
      if is_meta:
          for module in model.modules():
              # Assume that a module has `reset_parameters()` iff it has directly
              # managed parameters or buffers
              if hasattr(module, "reset_parameters"):
                  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 1 for calling a global function with example usage: _reset_params_if_meta(is_meta, model) without return types