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","]","]",")",":"]
docstr: Performs AlltoAll operation on pooled embeddings tensor.
  
  Args:
      local_embs (torch.Tensor): tensor of values to distribute.
      sharding_ctx (Optional[EmbeddingShardingContext]): shared context from
          KJTAllToAll operation.
  
  Returns:
      Awaitable[torch.Tensor]: awaitable of pooled embeddings.
docstr_tok: ["Performs","AlltoAll","operation","on","pooled","embeddings","tensor",".","Args",":","local_embs","(","torch.Tensor",")",":","tensor","of","values","to","distribute",".","sharding_ctx","(","Optional","[","EmbeddingShardingContext","]",")",":","shared","context","from","KJTAllToAll","operation",".","Returns",":","Awaitable","[","torch.Tensor","]",":","awaitable","of","pooled","embeddings","."]
code: def forward(
      self,
      local_embs: torch.Tensor,
      sharding_ctx: Optional[EmbeddingShardingContext] = None,
  ) -> Awaitable[torch.Tensor]:
      """
      Performs AlltoAll operation on pooled embeddings tensor.
  
      Args:
          local_embs (torch.Tensor): tensor of values to distribute.
          sharding_ctx (Optional[EmbeddingShardingContext]): shared context from
              KJTAllToAll operation.
  
      Returns:
          Awaitable[torch.Tensor]: awaitable of pooled embeddings.
      """
      if self._dist is None:
          self._create_output_dist_module(sharding_ctx)
  
      if sharding_ctx is None:
          return cast(PooledEmbeddingsAllToAll, self._dist)(local_embs)
      elif sharding_ctx.variable_batch_per_feature:
          return cast(
              VariableBatchPooledEmbeddingsAllToAll, self._dist
          )(
              local_embs,
              batch_size_per_rank_per_feature=sharding_ctx.batch_size_per_rank_per_feature,
              batch_size_per_feature_pre_a2a=sharding_ctx.batch_size_per_feature_pre_a2a,
          )
      else:
          return cast(PooledEmbeddingsAllToAll, self._dist)(
              local_embs,
              batch_size_per_rank=sharding_ctx.batch_size_per_rank,
          )
  
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 2 for calling the TwPooledEmbeddingDist obj's underlying member method code with example usage: obj.forward(local_embs, sharding_ctx) and returns: cast, cast, cast