code: def np_to_data_creator(tuple_data, shuffle=False):
      def data_creator(config, batch_size):
          data_len = tuple_data[0].shape[0]
          data = tf.data.Dataset.from_tensor_slices((tuple_data))
          if shuffle:
              data = data.cache().shuffle(data_len).batch(batch_size)
          else:
              data = data.batch(batch_size).cache()
          return data.prefetch(tf.data.AUTOTUNE)
  
      return data_creator
  
file_path: BigDL/python/chronos/src/bigdl/chronos/forecaster/tf/utils.py
imports: import tensorflow
  import numpy
  import math
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: np_to_data_creator(tuple_data, shuffle) and returns: data_creator, data