code: def test_train_eval(self, sharding_strategy: ShardingStrategy):
      dist.set_debug_level(dist.DebugLevel.DETAIL)
      fsdp_model = Model.wrap(sharding_strategy, self.device)
      NUM_ITERS = 3
      NUM_EPOCHS = 2
      with warnings.catch_warnings(
          record=True
      ) as w:  # records warnings to `w`
          for _ in range(NUM_EPOCHS):
              fsdp_model.train()
              for _ in range(NUM_ITERS):
                  inp = fsdp_model.module.get_input(self.device)
                  output = fsdp_model(*inp)
                  loss = fsdp_model.module.get_loss(inp, output).to(
                      self.device
                  )
                  fsdp_model.module.run_backward(loss)
              fsdp_model.eval()
              for _ in range(NUM_ITERS):
                  inp = fsdp_model.module.get_input(self.device)
                  output = fsdp_model(*inp)
                  fsdp_model.module.get_loss(inp, output).to(
                      self.device
                  )
      # Check that the order validation warning was not issued (errors do not
      # need to be checked since they will be directly reported)
      warning_prefix = "Forward order differs"
      for warning in w:
          if str(warning.message).startswith(warning_prefix):
              raise AssertionError(
                  f"Warning was incorrectly issued: {warning.message}"
              )
  
imports: import sys
  import warnings
  from contextlib import nullcontext
  import torch
  from torch import distributed
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.distributed.fsdp.fully_sharded_data_parallel import ShardingStrategy
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import FSDPTest
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 5 for calling the TestFSDPExecOrder obj's underlying member method code with example usage: obj.test_train_eval(sharding_strategy) without return types