class_docstr: Tests ``fully_shard`` model checkpointing.
class_docstr_tok: ["Tests","``","fully_shard","``","model","checkpointing","."]
docstr: Checks that ``m1`` and ``m2`` have equal ``named_parameters()``.
docstr_tok: ["Checks","that","``","m1","``","and","``","m2","``","have","equal","``","named_parameters","(",")","``","."]
code: def _check_model_parity(self, m1: nn.Module, m2: nn.Module):
      """
      Checks that ``m1`` and ``m2`` have equal ``named_parameters()``.
      """
      for (n1, p1), (n2, p2) in zip(
          m1.named_parameters(), m2.named_parameters()
      ):
          self.assertEqual(n1, n2)
          self.assertEqual(p1, p2)
  
imports: import copy
  import itertools
  import sys
  from typing import Dict
  import torch
  import torch.distributed
  import torch.nn
  from torch.distributed._composable import fully_shard
  from torch.distributed._state_dict_utils import _gather_state_dict
  from torch.distributed.fsdp import FullyShardedDataParallel, StateDictType
  from torch.distributed.fsdp.api import ShardingStrategy
  from torch.distributed.fsdp.wrap import ModuleWrapPolicy
  from torch.nn import TransformerDecoderLayer, TransformerEncoderLayer
  from torch.testing._internal.common_dist_composable import CompositeParamModel, UnitModule
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import _zero_model, CUDAInitMode, FSDPInitMode, FSDPTest, TransformerWithSharedParams
  from torch.testing._internal.common_utils import run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 8 for calling the TestModelCheckpointing obj's underlying member method code with example usage: obj._check_model_parity(m1, m2) without return types