Consider the code below. The batch data is created with the command tf.keras.preprocessing.timeseries_dataset_from_array. I want to manipulate every array in the batch data in such a way that i want to add the constant “99” to it. The variable feature_ds contains the batch data sets.
import tensorflow as tf
import numpy as np
 
simple_data_samples = np.array([
         [1, 1, 1, -1, -1],
         [2, 2, 2, -2, -2],
         [3, 3, 3, -3, -3],
         [4, 4, 4, -4, -4],
         [5, 5, 5, -5, -5],
         [6, 6, 6, -6, -6],
         [7, 7, 7, -7, -7],
         [8, 8, 8, -8, -8],
         [9, 9, 9, -9, -9],
         [10, 10, 10, -10, -10],
         [11, 11, 11, -11, -11],
         [12, 12, 12, -12, -12],
])


def print_dataset(ds):
    for inputs, targets in ds:
        print("---Batch---")
        print("Feature:", inputs.numpy())
        print("Label:", targets.numpy())
        print("")


def timeseries_dataset_multistep_combined(features, label_slice, input_sequence_length, output_sequence_length, batch_size):
    feature_ds = tf.keras.preprocessing.timeseries_dataset_from_array(features, None, input_sequence_length + output_sequence_length, batch_size=batch_size)
     
    def split_feature_label(x):
   
        return x[:, :input_sequence_length, :], x[:, input_sequence_length:, label_slice]
         
    feature_ds = feature_ds.map(split_feature_label)
    
    return feature_ds
 
ds = timeseries_dataset_multistep_combined(simple_data_samples, slice(3, None, None), input_sequence_length=4, output_sequence_length=2, batch_size=2)
print_dataset(ds)