code: def check_weights(self, fsdp, expected_tensor_fn, check):
      with FSDP.summon_full_params(fsdp, recurse=True):
          linear_modules = [
              module
              for module in fsdp.modules()
              if type(module) == nn.Linear
          ]
          for module in linear_modules:
              for param in module.parameters():
                  expected = expected_tensor_fn(param)
                  check(
                      param,
                      expected,
                      f"Got {param} but expected {expected}",
                  )
  
file_path: pytorch/test/distributed/fsdp/test_fsdp_apply.py
imports: import sys
  import torch
  import torch.distributed
  import torch.nn
  from torch.distributed.fsdp import FullyShardedDataParallel
  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 3 for calling the TestApply obj's underlying member method code with example usage: obj.check_weights(fsdp, expected_tensor_fn, check) without return types