def compute_mask_offsets(shard_id2num_examples):
  """Return the list of offsets associated with each shards.

  Args:
    shard_id2num_examples: `list[int]`, mapping shard_id=>num_examples

  Returns:
    mask_offsets: `list[int]`, offset to skip for each of the shard
  """
  total_num_examples = sum(shard_id2num_examples)

  mask_offsets = []
  total_num_examples = 0
  for num_examples_in_shard in shard_id2num_examples:
    # The offset (nb of examples to skip in the next shard) correspond to the
    # number of examples remaining in the current shard
    mask_offsets.append(total_num_examples % 100)
    total_num_examples += num_examples_in_shard

  return mask_offsets
Return the list of offsets associated with each shards.

  Args:
    shard_id2num_examples: `list[int]`, mapping shard_id=>num_examples

  Returns:
    mask_offsets: `list[int]`, offset to skip for each of the shard