code: def reshape_ragged_tensor(
      values: np.ndarray,
      row_lengths: list[Sequence[int]],
      shape: tuple[Union[int, None], ...],
  ) -> Union[np.ndarray, list[Any]]:
      """Reshapes a list to a heterogeneous NumPy array.
  
      Warning: this function makes copies of arrays. It could be optimized by not
      recreating the array at each iteration but by reshaping an existing array.
  
      Args:
        values: 1-dimension array with all the values to reshape.
        row_lengths: array of length of the unknown dimension.
        shape: target shape of the array containing None for unknown dimensions.
  
      Returns:
        An array of ragged NumPy arrays.
      """
      if not row_lengths:
          # Reshape with (None, 3, 4) -> (-1, 3, 4).
          return values.reshape(
              [d if d is not None else -1 for d in shape]
          )
      full_row_lengths = _full_row_lengths(values, row_lengths, shape)
      # We start by the most upright dimension, which is the innerest dimension.
      for row_length in full_row_lengths:
          array = []
          i = 0
          for length in row_length:
              value = values[i : i + length]
              array.append(value)
              i += length
          values = array
      return values
  
imports: from __future__ import annotations
  import abc
  from collections.abc import Iterable, Mapping, Sequence
  import dataclasses
  import re
  from typing import Any, Union
  import numpy
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.features import feature
  from tensorflow_datasets.core.utils import dtype_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.proto import tf_example_pb2
  from tensorflow_datasets.proto import tf_feature_pb2
label_desc: Use image node_id 6 for calling a global function with example usage: reshape_ragged_tensor(values, row_lengths, shape) and returns: values, values