code: def test_ignored_modules_not_under_wrapped_root(
      self, ignore_modules: bool, composable: bool
  ):
      model = Model().cuda()
      ignored_modules = list(model.layer1.children())[1:]
  
      ignore_kwargs = (
          {"ignored_modules": ignored_modules}
          if ignore_modules
          else {
              "ignored_states": {
                  p for m in ignored_modules for p in m.parameters()
              }
          }
      )
  
      wrap_cls = FSDP if composable else fully_shard
  
      model.layer1 = wrap_cls(
          model.layer1,
          **ignore_kwargs,
      )
      model.layer3 = wrap_cls(
          model.layer3,
          # the ignored modules/parameters contains submodule under model.layer1, which
          # is out of the local root model.layer3.
          **ignore_kwargs,
      )
  
      optim = torch.optim.Adam(model.parameters(), lr=1e-3)
      self._train_model(model, optim, 3)
  
imports: import functools
  import math
  import sys
  import torch
  import torch.distributed.fsdp._traversal_utils
  import torch.nn
  from torch import distributed
  from torch.distributed._composable import fully_shard
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.distributed.fsdp._common_utils import _get_module_fsdp_state
  from torch.distributed.fsdp.wrap import ModuleWrapPolicy, transformer_auto_wrap_policy
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import CUDAInitMode, FSDPInitMode, FSDPTest, TransformerWithSharedParams
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 14 for calling the TestFSDPIgnoredModules obj's underlying member method code with example usage: obj.test_ignored_modules_not_under_wrapped_root(ignore_modules, composable) without return types