class_docstr: Base test class and used for CPU case.
docstr: Test that unflattened state dict matches original (unwrapped) one.
docstr_tok: ["Test","that","unflattened","state","dict","matches","original","(","unwrapped",")","one","."]
code: def test_state_dict_equality(self):
      """Test that unflattened state dict matches original (unwrapped) one."""
      modules_to_test = [
          init_fn() for init_fn in self._get_module_init_fns()
      ]
      for module in modules_to_test:
          ref_state_dict = module.state_dict()
  
          flat_module = FlattenParamsWrapper(module)
          flat_state_dict = flat_module.state_dict()
  
          assert (
              ref_state_dict.keys() == flat_state_dict.keys()
          ), f"{ref_state_dict.keys()} != {flat_state_dict.keys()}"
          assert objects_are_equal(
              ref_state_dict, flat_state_dict
          ), f"{ref_state_dict} != {flat_state_dict}"
  
imports: from collections import OrderedDict
  import unittest
  import torch
  from fairscale.fair_dev.testing.testing import objects_are_equal
  from fairscale.nn import FlattenParamsWrapper
label_desc: Use image node_id 21 for calling the TestFlattenParams obj's underlying member method code with example usage: obj.test_state_dict_equality() without return types