code: def test_parameter_sharding_ebc(
      self,
      per_param_sharding: Dict[str, ParameterShardingGenerator],
      qcomms_config: QCommsConfig,
  ) -> None:
      WORLD_SIZE = 2
      EMBEDDING_DIM = 8
      NUM_EMBEDDINGS = 4
  
      embedding_bag_config = [
          EmbeddingBagConfig(
              name=str(idx),
              feature_names=[f"feature_{idx}"],
              embedding_dim=EMBEDDING_DIM,
              num_embeddings=NUM_EMBEDDINGS,
          )
          for idx in per_param_sharding
      ]
  
      # Rank 0
      #             instance 0   instance 1  instance 2
      # "feature_0"   [0, 1]       []        [2]
      # "feature_1"   [2]       [2,3]     []
      # "feature_2"   [0,1,2,3]       [0,2]        [2,3]
  
      # Rank 1
  
      #             instance 0   instance 1  instance 2
      # "feature_0"   [3, 2]       [1,2]        [0, 1,2,3]
      # "feature_1"   [2,3]       None        [2]
      # "feature_2"   [0, 1]       None        [2]
  
      kjt_input_per_rank = [  # noqa
          KeyedJaggedTensor.from_lengths_sync(
              keys=["feature_0", "feature_1", "feature_2"],
              values=torch.LongTensor(
                  [0, 1, 2, 2, 2, 3, 0, 1, 2, 3, 0, 2, 2, 3]
              ),
              lengths=torch.LongTensor([2, 0, 1, 1, 2, 0, 4, 2, 2]),
          ),
          KeyedJaggedTensor.from_lengths_sync(
              keys=["feature_0", "feature_1", "feature_2"],
              values=torch.LongTensor(
                  [3, 2, 1, 2, 0, 1, 2, 3, 2, 3, 2, 0, 1, 2]
              ),
              lengths=torch.LongTensor([2, 2, 4, 2, 0, 1, 2, 0, 1]),
          ),
      ]
  
      sharder = EmbeddingBagCollectionSharder(
          qcomm_codecs_registry=get_qcomm_codecs_registry(qcomms_config)
          if qcomms_config is not None
          else None
      )
  
      ebc = EmbeddingBagCollection(tables=embedding_bag_config)
      apply_optimizer_in_backward(
          torch.optim.SGD,
          ebc.parameters(),
          {"lr": 1.0},
      )
  
      parameter_sharding_plan = construct_module_sharding_plan(
          module=ebc,
          per_param_sharding=per_param_sharding,
          local_size=2,
          world_size=2,
          # pyre-ignore
          sharder=sharder,
      )
  
      self._run_multi_process_test(
          callable=_test_sharding,
          world_size=WORLD_SIZE,
          tables=embedding_bag_config,
          initial_state_dict={
              "embedding_bags.0.weight": torch.Tensor(
                  [[1] * EMBEDDING_DIM for val in range(NUM_EMBEDDINGS)]
              ),
              "embedding_bags.1.weight": torch.Tensor(
                  [[2] * EMBEDDING_DIM for val in range(NUM_EMBEDDINGS)]
              ),
              "embedding_bags.2.weight": torch.Tensor(
                  [[3] * EMBEDDING_DIM for val in range(NUM_EMBEDDINGS)]
              ),
          },
          kjt_input_per_rank=kjt_input_per_rank,
          backend="nccl"
          if (
              torch.cuda.is_available()
              and torch.cuda.device_count() >= 2
          )
          else "gloo",
          sharder=sharder,
          parameter_sharding_plan=parameter_sharding_plan,
      )
  
imports: import copy
  import unittest
  from typing import Any, Dict, List, Optional
  import hypothesis.strategies
  import torch
  import torch.nn
  import torchrec.distributed
  from hypothesis import given, settings, Verbosity
  from torch.distributed.optim import _apply_optimizer_in_backward
  from torchrec.distributed.embeddingbag import EmbeddingBagCollectionSharder
  from torchrec.distributed.fbgemm_qcomm_codec import CommType, get_qcomm_codecs_registry, QCommsConfig
  from torchrec.distributed.sharding_plan import column_wise, construct_module_sharding_plan, ParameterShardingGenerator, row_wise, table_wise
  from torchrec.distributed.test_utils.multi_process import MultiProcessContext, MultiProcessTestBase
  from torchrec.distributed.test_utils.test_sharding import copy_state_dict
  from torchrec.distributed.types import ModuleSharder, ParameterSharding, ShardingEnv
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
  from torchrec.test_utils import skip_if_asan_class
label_desc: Use image node_id 1 for calling the ConstructParameterShardingTest obj's underlying member method code with example usage: obj.test_parameter_sharding_ebc(per_param_sharding, qcomms_config) without return types