class_docstr: Redistributes pooled embedding tensor with an AlltoAll collective operation for
  table wise sharding.
  
  Args:
      pg (dist.ProcessGroup): ProcessGroup for AlltoAll communication.
      dim_sum_per_rank (List[int]): number of features (sum of dimensions) of the
          embedding in each rank.
      emb_dim_per_rank_per_feature (List[List[int]]): embedding dimension per rank per
          feature, used for variable batch per feature.
      device (Optional[torch.device]): device on which buffers will be allocated.
      callbacks (Optional[List[Callable[[torch.Tensor], torch.Tensor]]]):
      qcomm_codecs_registry (Optional[Dict[str, QuantizedCommCodecs]]):
class_docstr_tok: ["Redistributes","pooled","embedding","tensor","with","an","AlltoAll","collective","operation","for","table","wise","sharding",".","Args",":","pg","(","dist.ProcessGroup",")",":","ProcessGroup","for","AlltoAll","communication",".","dim_sum_per_rank","(","List","[","int","]",")",":","number","of","features","(","sum","of","dimensions",")","of","the","embedding","in","each","rank",".","emb_dim_per_rank_per_feature","(","List","[","List","[","int","]","]",")",":","embedding","dimension","per","rank","per","feature",",","used","for","variable","batch","per","feature",".","device","(","Optional","[","torch.device","]",")",":","device","on","which","buffers","will","be","allocated",".","callbacks","(","Optional","[","List","[","Callable","[","[","torch.Tensor","]",",","torch.Tensor","]","]","]",")",":","qcomm_codecs_registry","(","Optional","[","Dict","[","str",",","QuantizedCommCodecs","]","]",")",":"]
code: def __init__(
      self,
      pg: dist.ProcessGroup,
      dim_sum_per_rank: List[int],
      emb_dim_per_rank_per_feature: List[List[int]],
      device: Optional[torch.device] = None,
      callbacks: Optional[
          List[Callable[[torch.Tensor], torch.Tensor]]
      ] = None,
      qcomm_codecs_registry: Optional[
          Dict[str, QuantizedCommCodecs]
      ] = None,
  ) -> None:
      super().__init__()
      self._pg = pg
      self._dim_sum_per_rank = dim_sum_per_rank
      self._device = device
      self._callbacks = callbacks
      self._codecs: Optional[QuantizedCommCodecs] = (
          qcomm_codecs_registry.get(
              CommOp.POOLED_EMBEDDINGS_ALL_TO_ALL.name, None
          )
          if qcomm_codecs_registry
          else None
      )
      self._emb_dim_per_rank_per_feature = emb_dim_per_rank_per_feature
      self._dist: Optional[
          Union[
              PooledEmbeddingsAllToAll,
              VariableBatchPooledEmbeddingsAllToAll,
          ]
      ] = None
  
imports: from typing import Any, Callable, cast, Dict, List, Optional, TypeVar, Union
  import torch
  import torch.distributed
  from torchrec.distributed.dist_data import EmbeddingsAllToOne, KJTAllToAll, KJTOneToAll, PooledEmbeddingsAllToAll, VariableBatchPooledEmbeddingsAllToAll
  from torchrec.distributed.embedding_lookup import GroupedPooledEmbeddingsLookup, InferGroupedPooledEmbeddingsLookup
  from torchrec.distributed.embedding_sharding import BaseEmbeddingDist, BaseEmbeddingLookup, BaseSparseFeaturesDist, EmbeddingSharding, EmbeddingShardingContext, EmbeddingShardingInfo, group_tables
  from torchrec.distributed.embedding_types import BaseGroupedFeatureProcessor, EmbeddingComputeKernel, GroupedEmbeddingConfig, KJTList, ShardedEmbeddingTable
  from torchrec.distributed.types import Awaitable, CommOp, NullShardingContext, QuantizedCommCodecs, ShardedTensorMetadata, ShardingEnv, ShardMetadata
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor
  from torchrec.streamable import Multistreamable
label_desc: Use image node_id 1 to create a new TwPooledEmbeddingDist object from inherited base classes: BaseEmbeddingDist with example: obj = TwPooledEmbeddingDist(pg, dim_sum_per_rank, emb_dim_per_rank_per_feature, device, callbacks, qcomm_codecs_registry)