sample_length = 20 input_dataset = tf.keras.preprocessing.timeseries_dataset_from_array( X, None, sequence_length=sample_length, sequence_stride=sample_length) target_dataset = tf.keras.preprocessing.timeseries_dataset_from_array( Y, None, sequence_length=sample_length, sequence_stride=sample_length)