docstr: Tests that ``named_parameters()`` and ``named_buffers()`` for a
  top-level FSDP-wrapped model matches their behavior for the equivalent
  non-wrapped module.
docstr_tok: ["Tests","that","``","named_parameters","(",")","``","and","``","named_buffers","(",")","``","for","a","top-level","FSDP-wrapped","model","matches","their","behavior","for","the","equivalent","non-wrapped","module","."]
code: def test_named_parameters_and_buffers(self):
      """
      Tests that ``named_parameters()`` and ``named_buffers()`` for a
      top-level FSDP-wrapped model matches their behavior for the equivalent
      non-wrapped module.
      """
      self.run_subtests(
          {"prefix": ["", "test_prefix"], "recurse": [False, True]},
          self._test_named_parameters_and_buffers,
      )
  
imports: import contextlib
  import itertools
  import math
  import sys
  from typing import Any, Dict, List, Optional, Union
  import torch
  import torch.distributed.fsdp._traversal_utils
  import torch.nn
  from torch import distributed
  from torch.distributed.fsdp import CPUOffload, FullyShardedDataParallel, MixedPrecision, ShardingStrategy
  from torch.distributed.fsdp._common_utils import clean_tensor_name
  from torch.distributed.fsdp._flat_param import FlatParameter
  from torch.nn.parallel.distributed import DistributedDataParallel
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import CUDAInitMode, FSDPInitMode, FSDPTest, NestedWrappedModule, TransformerWithSharedParams
  from torch.testing._internal.common_utils import run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 9 for calling the TestUnshardParams obj's underlying member method code with example usage: obj.test_named_parameters_and_buffers() without return types