code: def _calculate_rw_shard_sizes_and_offsets(
      hash_size: int, num_devices: int, columns: int
  ) -> Tuple[List[List[int]], List[List[int]]]:
      """
      Sets prefix of shard_sizes to be `math.ceil(hash_size/num_devices)`.
  
      For example if hash_size = 10, num_devices = 4, we will allocate the rows as 3,3,3,1
      (rather than 3,3,2,2).
      This is due to implementation in RW sharding that sets block_size_lists to be ceil.
      The balanced way is harder to support on GPU.
      For more details see https://fb.quip.com/xbgbAchCTOL0
  
      Also consider the example of hash_size = 5, num_devices = 4. The expected rows per
      rank is [2,2,1,0].
      """
  
      block_size: int = math.ceil(hash_size / num_devices)
      last_rank: int = hash_size // block_size
      last_block_size: int = hash_size - block_size * last_rank
      shard_sizes: List[List[int]] = []
  
      for rank in range(num_devices):
          if rank < last_rank:
              local_row: int = block_size
          elif rank == last_rank:
              local_row: int = last_block_size
          else:
              local_row: int = 0
          shard_sizes.append([local_row, columns])
      shard_offsets = [[0, 0]]
  
      for i in range(num_devices - 1):
          shard_offsets.append(
              [shard_sizes[i][0] + shard_offsets[i][0], 0]
          )
  
      return shard_sizes, shard_offsets
  
imports: import math
  import warnings
  from typing import Callable, cast, Dict, List, Optional, Tuple, Type
  import torch
  from torch import distributed, nn
  from torchrec.distributed.comm import get_local_size
  from torchrec.distributed.embedding import EmbeddingCollectionSharder
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.embeddingbag import EmbeddingBagCollectionSharder
  from torchrec.distributed.fp_embeddingbag import FeatureProcessedEmbeddingBagCollectionSharder
  from torchrec.distributed.fused_embeddingbag import FusedEmbeddingBagCollectionSharder
  from torchrec.distributed.mc_embedding import ManagedCollisionEmbeddingCollectionSharder
  from torchrec.distributed.mc_embeddingbag import ManagedCollisionEmbeddingBagCollectionSharder
  from torchrec.distributed.planner.constants import MIN_CW_DIM
  from torchrec.distributed.quant_embedding import QuantEmbeddingCollectionSharder
  from torchrec.distributed.quant_embeddingbag import QuantEmbeddingBagCollectionSharder
  from torchrec.distributed.types import EmbeddingModuleShardingPlan, EnumerableShardingSpec, ModuleSharder, ParameterSharding, ShardingType, ShardMetadata
  from torchrec.distributed.utils import none_throws
label_desc: Use image node_id 5 for calling a global function with example usage: _calculate_rw_shard_sizes_and_offsets(hash_size, num_devices, columns) and returns: shard_sizes,  shard_offsets