code: def _test_nested_wrapped_model(cls, rank, group, config=None):
      # Get reference state dict without any nested FSDP instances.
      model = NestedWrappedModule(group, None).cuda()
      model = nn.parallel.DistributedDataParallel(
          model,
          device_ids=[rank],
          output_device=rank,
          process_group=group,
      )
      cls._train_for_several_steps(
          model, 2, autocast=config["mixed_precision"]
      )
      ref_state_dict = {
          k: v.clone() for k, v in model.module.state_dict().items()
      }
  
      # Create a nested FSDP-wrapped instance.
      if config["mixed_precision"]:
          config["compute_dtype"] = torch.float32
      model = NestedWrappedModule(group, config)
      model = FSDP(model, group, **config).cuda()
      cls._train_for_several_steps(
          model, 2, autocast=config["mixed_precision"]
      )
  
      # Round-trip state dict save/load/save.
      state_dict = {k: v.clone() for k, v in model.state_dict().items()}
      model.load_state_dict(state_dict)
      state_dict = model.state_dict()
  
      assert (
          ref_state_dict.keys() == state_dict.keys()
      ), f"{ref_state_dict.keys()} != {state_dict.keys()}"
      for key in ref_state_dict.keys():
          assert objects_are_equal(
              ref_state_dict[key],
              state_dict[key],
              raise_exception=False,
          ), f"{key}, {ref_state_dict[key]} != {state_dict[key]}"
  
imports: import functools
  import unittest
  from parameterized import parameterized
  import pytest
  import torch
  from torch import nn
  from fairscale.fair_dev.testing.testing import dist_init, objects_are_equal, skip_if_cuda, teardown, temp_files_ctx
  from fairscale.internal import torch_version
  from fairscale.nn.data_parallel import FullyShardedDataParallel
  from .test_fsdp import CONFIG_OPTIONS, DistributedTest, NestedWrappedModule, TransformerWithSharedParams, rename_test, spawn_and_init
label_desc: Use image node_id 9 for calling the TestSaveLoadStateDict obj's underlying member method code with example usage: obj._test_nested_wrapped_model(cls, rank, group, config) without return types