code: def test_parallelize_mlp_with_module_api_nested(self):
      inp_size = [12, 10]
      model = torch.nn.Sequential(
          OrderedDict([("dummy_encoder", MLPModule(self.device_type))])
      )
      model_tp = torch.nn.Sequential(
          OrderedDict([("dummy_encoder", MLPModule(self.device_type))])
      )
  
      # Ensure model are initialized the same way.
      self.assertEqual(
          model.dummy_encoder.net1.weight,
          model_tp.dummy_encoder.net1.weight,
      )
      self.assertEqual(
          model.dummy_encoder.net1.bias,
          model_tp.dummy_encoder.net1.bias,
      )
      self.assertEqual(
          model.dummy_encoder.net2.weight,
          model_tp.dummy_encoder.net2.weight,
      )
      self.assertEqual(
          model.dummy_encoder.net2.bias,
          model_tp.dummy_encoder.net2.bias,
      )
  
      # Parallelize module.
      device_mesh = DeviceMesh(
          self.device_type, torch.arange(self.world_size)
      )
      model_tp = parallelize_module(
          model_tp,
          device_mesh,
          {
              "dummy_encoder.net1": ColwiseParallel(
                  output_layouts=Replicate()
              ),
              "dummy_encoder.net2": ColwiseParallel(
                  output_layouts=Replicate()
              ),
          },
      )
      self._compare_module(model, model_tp, inp_size, rank0_only=False)
  
imports: from collections import OrderedDict
  import torch
  from torch.distributed._tensor import DeviceMesh, DTensor, Replicate, Shard
  from torch.distributed.tensor.parallel._utils import _create_1d_device_mesh
  from torch.distributed.tensor.parallel.api import parallelize_module
  from torch.distributed.tensor.parallel.style import ColwiseParallel, PrepareModuleInput, PrepareModuleOutput, RowwiseParallel
  from torch.testing._internal.common_utils import run_tests
  from torch.testing._internal.distributed._tensor.common_dtensor import DTensorTestBase, MLPModule, with_comms
label_desc: Use image node_id 7 for calling the TensorParallelAPITests obj's underlying member method code with example usage: obj.test_parallelize_mlp_with_module_api_nested() without return types