code: def test_parameter_sharding_ebc(
      self,
      per_param_sharding: Dict[str, ParameterShardingGenerator],
  ) -> None:
      WORLD_SIZE = 2
  
      embedding_bag_config = [
          EmbeddingBagConfig(
              name="table_0",
              feature_names=["feature_0"],
              embedding_dim=16,
              num_embeddings=4,
          ),
          EmbeddingBagConfig(
              name="table_1",
              feature_names=["feature_1"],
              embedding_dim=16,
              num_embeddings=4,
          ),
      ]
  
      # Rank 0
      #             instance 0   instance 1  instance 2
      # "feature_0"   [0, 1]       None        [2]
      # "feature_1"   [0, 1]       None        [2]
  
      # Rank 1
  
      #             instance 0   instance 1  instance 2
      # "feature_0"   [3, 2]       [1,2]        [0, 1,2,3]
      # "feature_1"   [2,3]       None        [2]
  
      kjt_input_per_rank = [  # noqa
          KeyedJaggedTensor.from_lengths_sync(
              keys=["feature_0", "feature_1"],
              values=torch.LongTensor([0, 1, 2, 0, 1, 2]),
              lengths=torch.LongTensor([2, 0, 1, 2, 0, 1]),
          ),
          KeyedJaggedTensor.from_lengths_sync(
              keys=["feature_0", "feature_1"],
              values=torch.LongTensor(
                  [3, 2, 1, 2, 0, 1, 2, 3, 2, 3, 2]
              ),
              lengths=torch.LongTensor([2, 2, 4, 2, 0, 1]),
          ),
      ]
  
      module_sharding_plan = construct_module_sharding_plan(
          EmbeddingBagCollection(tables=embedding_bag_config),
          per_param_sharding=per_param_sharding,
          local_size=WORLD_SIZE,
          world_size=WORLD_SIZE,
          device_type="cuda" if torch.cuda.is_available() else "cpu",
      )
  
      # Row-wise not supported on gloo
      if (
          not torch.cuda.is_available()
          and module_sharding_plan["table_0"].sharding_type
          == ShardingType.ROW_WISE.value
      ):
          return
  
      self._run_multi_process_test(
          callable=_test_sharding,
          world_size=WORLD_SIZE,
          tables=embedding_bag_config,
          initial_state_dict={
              "embedding_bags.table_0.weight": torch.Tensor(
                  [
                      [1] * 16,
                      [2] * 16,
                      [3] * 16,
                      [4] * 16,
                  ]
              ),
              "embedding_bags.table_1.weight": torch.Tensor(
                  [
                      [101] * 16,
                      [102] * 16,
                      [103] * 16,
                      [104] * 16,
                  ]
              ),
          },
          kjt_input_per_rank=kjt_input_per_rank,
          backend="nccl" if torch.cuda.is_available() else "gloo",
          module_sharding_plan=module_sharding_plan,
      )
  
imports: import copy
  import unittest
  from typing import Any, Dict, List, Optional
  import hypothesis.strategies
  import torch
  from hypothesis import given, settings, Verbosity
  from torchrec import distributed
  from torchrec.distributed.sharding_plan import column_wise, construct_module_sharding_plan, data_parallel, EmbeddingBagCollectionSharder, EmbeddingCollectionSharder, FeatureProcessedEmbeddingBagCollectionSharder, FusedEmbeddingBagCollectionSharder, get_module_to_default_sharders, ManagedCollisionEmbeddingBagCollectionSharder, ManagedCollisionEmbeddingCollectionSharder, ParameterShardingGenerator, QuantEmbeddingBagCollectionSharder, QuantEmbeddingCollectionSharder, row_wise, table_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 EmbeddingModuleShardingPlan, EnumerableShardingSpec, ParameterSharding, ShardingEnv, ShardingPlan, ShardingType, ShardMetadata
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection, EmbeddingCollection
  from torchrec.modules.fp_embedding_modules import FeatureProcessedEmbeddingBagCollection
  from torchrec.modules.fused_embedding_modules import FusedEmbeddingBagCollection
  from torchrec.modules.mc_embedding_modules import ManagedCollisionEmbeddingBagCollection, ManagedCollisionEmbeddingCollection
  from torchrec.quant.embedding_modules import EmbeddingBagCollection, EmbeddingCollection
  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 ConstructParameterShardingAndShardTest obj's underlying member method code with example usage: obj.test_parameter_sharding_ebc(per_param_sharding) without return types