code: def _get_all_dimensions(
      batch: Sequence,
      level: int = 0,
      res: Optional[List[List[int]]] = None,
  ) -> List[List[int]]:
      """Return all presented element sizes of each dimension.
  
      Args:
          batch: Data array.
          level: Recursion level.
          res: List containing element sizes of each dimension.
  
      Return:
          List, i-th element of which is list containing all presented sized of batch's i-th dimension.
  
      Examples:
          >>> x = [[[1], [2, 3]], [[4], [5, 6, 7], [8, 9]]]
          >>> _get_all_dimensions(x)
          [[2], [2, 3], [1, 2, 1, 3, 2]]
  
      """
      if not level:
          res = [[len(batch)]]
      if (
          len(batch)
          and isinstance(batch[0], Sized)
          and not isinstance(batch[0], str)
      ):
          level += 1
          if len(res) <= level:
              res.append([])
          for item in batch:
              res[level].append(len(item))
              _get_all_dimensions(item, level, res)
      return res
  
imports: import collections
  import gzip
  import os
  import secrets
  import shutil
  import tarfile
  import zipfile
  from hashlib import md5
  from itertools import chain
  from logging import getLogger
  from pathlib import Path
  from typing import Any, Generator, Iterable, List, Mapping, Optional, Sequence, Sized, Union, Collection
  from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit, urlparse
  import numpy
  import requests
  from tqdm import tqdm
label_desc: Use image node_id 12 for calling a global function with example usage: _get_all_dimensions(batch, level, res) and returns: res