code: def indices_to_split_size(indices, total_elements: int = None):
      """convert indices to split_size
  
      During decoding, the api torch.tensor_split should be used.
      However, torch.tensor_split is only available with pytorch >= 1.8.0.
      So torch.split is used to pass ci with pytorch < 1.8.0.
      This fuction is used to prepare input for torch.split.
      """
      if indices[0] != 0:
          indices = [0] + indices
  
      split_size = [
          indices[i] - indices[i - 1] for i in range(1, len(indices))
      ]
      if (
          total_elements is not None
          and sum(split_size) != total_elements
      ):
          split_size.append(total_elements - sum(split_size))
      return split_size
  
imports: import argparse
  import datetime
  import logging
  import sys
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
  import k2
  import numpy
  import torch
  import yaml
  from typeguard import check_argument_types, check_return_type
  from espnet2.fileio.datadir_writer import DatadirWriter
  from espnet2.fst.lm_rescore import nbest_am_lm_scores
  from espnet2.tasks.asr import ASRTask
  from espnet2.tasks.lm import LMTask
  from espnet2.text.build_tokenizer import build_tokenizer
  from espnet2.text.token_id_converter import TokenIDConverter
  from espnet2.torch_utils.device_funcs import to_device
  from espnet2.torch_utils.set_all_random_seed import set_all_random_seed
  from espnet2.utils import config_argparse
  from espnet2.utils.types import str2bool, str2triple_str, str_or_none
  from espnet.utils.cli_utils import get_commandline_args
label_desc: Use image node_id 1 for calling a global function with example usage: indices_to_split_size(indices, total_elements) and returns: split_size