code: def sequences_from_indices(array, indices_ds, start_index, end_index):
      dataset = tf.data.Dataset.from_tensors(
          array[start_index:end_index]
      )
      dataset = tf.data.Dataset.zip((dataset.repeat(), indices_ds)).map(
          lambda steps, inds: tf.gather(steps, inds),
          num_parallel_calls=tf.data.AUTOTUNE,
      )
      return dataset
  
imports: import numpy
  from keras.api_export import keras_export
  from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: sequences_from_indices(array, indices_ds, start_index, end_index) and returns: dataset