code: def _test_ignored_states_auto_wrap(self, policy, ignore_bias: bool):
      model = Model().cuda()
      ignored_states = [model.layer1[1].weight]
      if ignore_bias:
          ignored_states.append(model.layer1[1].bias)
      # Construct 2 flat parameters: one for `layer1` and one for the model
      fsdp_model = FSDP(
          model,
          # Use `False` to avoid complexity of intra-flat-parameter padding
          use_orig_params=False,
          auto_wrap_policy=policy,
          ignored_states=ignored_states,
      )
      ref_model = Model()
      expected_layer1_unsharded_numel = (
          sum(p.numel() for p in ref_model.layer1.parameters())
          - ref_model.layer1[1].weight.numel()
      )
      if ignore_bias:
          expected_layer1_unsharded_numel -= ref_model.layer1[
              1
          ].bias.numel()
      expected_model_unsharded_numel = sum(
          p.numel() for p in ref_model.parameters()
      ) - sum(p.numel() for p in ref_model.layer1.parameters())
      expected_layer1_sharded_numel = math.ceil(
          expected_layer1_unsharded_numel / self.world_size
      )
      expected_model_sharded_numel = math.ceil(
          expected_model_unsharded_numel / self.world_size
      )
      self.assertLessEqual(
          fsdp_model.layer1.module._flat_param.numel(),
          expected_layer1_sharded_numel,
      )
      self.assertLessEqual(
          fsdp_model.module._flat_param.numel(),
          expected_model_sharded_numel,
      )
  
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 10 for calling the TestFSDPIgnoredModules obj's underlying member method code with example usage: obj._test_ignored_states_auto_wrap(policy, ignore_bias) without return types