code: def tearDown(self):
      if torch.distributed.is_initialized():
          torch.distributed.destroy_process_group()
      del self.trainer
      registry.unregister("distributed")
  
file_path: mmf/tests/trainers/test_sharded_ddp.py
imports: import os
  import unittest
  import torch
  from mmf.common.registry import registry
  from mmf.trainers.mmf_trainer import MMFTrainer
  from mmf.utils.build import build_optimizer
  from omegaconf import OmegaConf
  from tests.test_utils import SimpleModel, skip_if_no_cuda
  from tests.trainers.test_training_loop import TrainerTrainingLoopMock
  from tests.trainers.test_utils import get_config_with_defaults
label_desc: Use image node_id 2 for calling the TestShardedDDP obj's underlying member method code with example usage: obj.tearDown() without return types