class_docstr: Base class for column-wise sharding.
class_docstr_tok: ["Base","class","for","column-wise","sharding","."]
code: def _shard(
      self,
      sharding_infos: List[EmbeddingShardingInfo],
  ) -> List[List[ShardedEmbeddingTable]]:
      world_size: int = self._env.world_size
      tables_per_rank: List[List[ShardedEmbeddingTable]] = [
          [] for i in range(world_size)
      ]
      for info in sharding_infos:
          # pyre-fixme [16]
          shards: List[
              ShardMetadata
          ] = info.param_sharding.sharding_spec.shards
  
          # construct the global sharded_tensor_metadata
          global_metadata = ShardedTensorMetadata(
              shards_metadata=shards,
              size=torch.Size(
                  [
                      info.embedding_config.num_embeddings,
                      info.embedding_config.embedding_dim,
                  ]
              ),
          )
  
          # pyre-fixme [6]
          for i, rank in enumerate(info.param_sharding.ranks):
              tables_per_rank[rank].append(
                  ShardedEmbeddingTable(
                      num_embeddings=info.embedding_config.num_embeddings,
                      embedding_dim=info.embedding_config.embedding_dim,
                      name=info.embedding_config.name,
                      embedding_names=info.embedding_config.embedding_names,
                      data_type=info.embedding_config.data_type,
                      feature_names=info.embedding_config.feature_names,
                      pooling=info.embedding_config.pooling,
                      is_weighted=info.embedding_config.is_weighted,
                      has_feature_processor=info.embedding_config.has_feature_processor,
                      local_rows=info.embedding_config.num_embeddings,
                      local_cols=shards[i].shard_sizes[1],
                      compute_kernel=EmbeddingComputeKernel(
                          info.param_sharding.compute_kernel
                      ),
                      local_metadata=shards[i],
                      global_metadata=global_metadata,
                      fused_params=info.fused_params,
                      weight_init_max=info.embedding_config.weight_init_max,
                      weight_init_min=info.embedding_config.weight_init_min,
                      pruning_indices_remapping=info.embedding_config.pruning_indices_remapping,
                  )
              )
  
      return tables_per_rank
  
imports: from typing import Any, Callable, Dict, List, Optional, Set, Tuple, TypeVar
  import torch
  import torch.distributed
  from fbgemm_gpu.permute_pooled_embedding_modules_split import PermutePooledEmbeddingsSplit
  from torchrec.distributed.dist_data import EmbeddingsAllToOne
  from torchrec.distributed.embedding_lookup import GroupedPooledEmbeddingsLookup, InferGroupedPooledEmbeddingsLookup
  from torchrec.distributed.embedding_sharding import BaseEmbeddingDist, BaseEmbeddingLookup, BaseSparseFeaturesDist, EmbeddingShardingContext, EmbeddingShardingInfo
  from torchrec.distributed.embedding_types import BaseGroupedFeatureProcessor, EmbeddingComputeKernel, KJTList, ShardedEmbeddingTable
  from torchrec.distributed.sharding.tw_sharding import BaseTwEmbeddingSharding, InferTwSparseFeaturesDist, TwPooledEmbeddingDist, TwSparseFeaturesDist
  from torchrec.distributed.types import NullShardingContext, QuantizedCommCodecs, ShardedTensorMetadata, ShardingEnv, ShardMetadata
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
  from torchrec.streamable import Multistreamable
label_desc: Use image node_id 3 for calling the BaseCwEmbeddingSharding obj's underlying member method code with example usage: obj._shard(sharding_infos) and returns: tables_per_rank