code: def np_to_tfdataset(tuple_data, shuffle=True, batch_size=32):
      data = tf.data.Dataset.from_tensor_slices((tuple_data))
      if shuffle:
          data = (
              data.cache()
              .shuffle(tuple_data[0].shape[0])
              .batch(batch_size)
          )
      else:
          data = data.batch(batch_size).cache()
      return data.prefetch(tf.data.AUTOTUNE)
  
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 3 for calling a global function with example usage: np_to_tfdataset(tuple_data, shuffle, batch_size) and returns: data