code: def _test_model_with_unused_params(self, rank, pg, wrap_l2):
      model = ModelWithUnusedParams(wrap_l2).cuda()
      data = torch.rand(4).cuda().requires_grad_(True)
      model = FullyShardedDataParallel(model)
      optim = SGD(model.parameters(), momentum=0.9, lr=0.1)
      out = model(data).sum()
      out.backward()
      optim.step()
      model.zero_grad(set_to_none=True)
      sd = model.gather_full_optim_state_dict(optim)
      if rank == 0:
          shard_sd = model.get_shard_from_optim_state_dict(sd)
          orig_sd = optim.state_dict()
          orig_sd = recursive_copy_to_device(
              orig_sd, non_blocking=False, device="cpu"
          )
          objects_are_equal(shard_sd, orig_sd, raise_exception=True)
      else:
          assert sd is None, sd
  
imports: import copy
  import functools
  from time import time
  import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  from torch.optim import SGD, Adadelta, Adam
  from fairscale.fair_dev.testing.testing import dist_init, objects_are_equal, spawn_for_all_world_sizes
  from fairscale.internal.params import recursive_copy_to_device
  from fairscale.nn.data_parallel import FullyShardedDataParallel, get_fsdp_instances
  from fairscale.nn.data_parallel.fsdp_optim_utils import is_singleton_tensor
  from .test_fsdp import DistributedTest, DummyProcessGroup, MixtureOfExperts, TransformerWithSharedParams, rename_test, spawn_and_init
label_desc: Use image node_id 5 for calling the TestOptimizerUtils obj's underlying member method code with example usage: obj._test_model_with_unused_params(rank, pg, wrap_l2) without return types