code: def test_local_state_dict_calls_state_dict_recursion():
      """Testing the case of infinite recursive when FSDP is subclassed"""
  
      class TestModule(FSDP):
          def __init__(self):
              super().__init__(module=nn.Linear(100, 100))
  
          def state_dict(self, *args, **kwargs):
              return self.local_state_dict(*args, **kwargs)
  
      rank = 0
      world_size = 1
      with temp_files_ctx(2) as temp_files:
          result = dist_init(
              rank, world_size, temp_files[0], temp_files[1]
          )
          assert result, "Dist init failed"
  
          m = TestModule()
          d = m.state_dict()
  
          teardown()
  
imports: import functools
  import unittest
  from parameterized import parameterized
  import pytest
  import torch
  from torch import nn
  from fairscale.fair_dev.testing.testing import dist_init, objects_are_equal, skip_if_cuda, teardown, temp_files_ctx
  from fairscale.internal import torch_version
  from fairscale.nn.data_parallel import FullyShardedDataParallel
  from .test_fsdp import CONFIG_OPTIONS, DistributedTest, NestedWrappedModule, TransformerWithSharedParams, rename_test, spawn_and_init
label_desc: Use image node_id 1 for calling a global function with example usage: test_local_state_dict_calls_state_dict_recursion() and returns: self