class_docstr: Adds a variable number of :class:`IgnoredModule` to ``self.layer1``.
class_docstr_tok: ["Adds","a","variable","number","of",":","class",":","`","IgnoredModule","`","to","``","self.layer1","``","."]
code: def __init__(self, num_ignored: int) -> None:
      assert num_ignored >= 0
      super().__init__()
      layer1_modules = (
          [torch.nn.Linear(5, 4), torch.nn.Linear(4, 4)]
          + [IgnoredModule(4, 4) for _ in range(num_ignored)]
          + [torch.nn.Linear(4, 4)]
      )
      self.layer1 = torch.nn.Sequential(*layer1_modules)
  
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 1 to create a new ModelWithIgnoredModules object from inherited base classes: Model with example: obj = ModelWithIgnoredModules(num_ignored)