docstr: Test to ensure force-leaf modules are not wrapped, and children are not wrapped.
docstr_tok: ["Test","to","ensure","force-leaf","modules","are","not","wrapped",",","and","children","are","not","wrapped","."]
code: def test_auto_wrap_preset_force_leaf(self):
      """
      Test to ensure force-leaf modules are not wrapped, and children are not wrapped.
      """
      with enable_wrap(
          wrapper_cls=FSDP,
          process_group=self.process_group,
          flatten_parameters=False,
      ):
          sequential = nn.Sequential(
              nn.Linear(10, 10), nn.MultiheadAttention(100, 1)
          )
          my_auto_wrap_policy = functools.partial(
              default_auto_wrap_policy, min_num_params=40
          )
          model = auto_wrap(
              sequential, auto_wrap_policy=my_auto_wrap_policy
          )
      assert isinstance(model.module[0], FSDP)
      # Assert children of multihead attention are not wrapped
      assert isinstance(model.module[1], nn.MultiheadAttention)
      assert isinstance(model.module[1].out_proj, nn.Linear)
  
imports: import functools
  import os
  import random
  import unittest
  import torch
  import torch.nn
  import torch.nn.functional
  from fairscale.fair_dev.testing.testing import DummyProcessGroup
  from fairscale.nn import FullyShardedDataParallel
  from fairscale.nn import auto_wrap, default_auto_wrap_policy, enable_wrap, wrap
label_desc: Use image node_id 9 for calling the TestAutoWrap obj's underlying member method code with example usage: obj.test_auto_wrap_preset_force_leaf() without return types