''TimeseriesGenerator' object has no attribute 'shape'

I have a LSTM model. which when I try to fit i get the error mentioned in the title.

I have an array of timeseries data with multiple features I'm feeding as input. The code that is causing the error is below.

TimeseriesGenerator(features, target, length=100, sampling_rate=1, batch_size=100)[0]

train_generator = TimeseriesGenerator(x_train,y_train,length=win_length,sampling_rate=1,batch_size=batch_size)


early_stopping=tf.keras.callbacks.EarlyStopping(monitor='val_loss',
                                                patience=2,
                                                mode='min')
model.compile(loss=tf.losses.MeanSquaredError(),
             optimizer=tf.optimizers.Adam(),
             metrics=[tf.metrics.MeanAbsoluteError()])

history=model.fit_generator(train_generator,epochs=50,
                           validation_data=test_generator,
                           shuffle=False,
                           callbacks=[early_stopping])

I've been losing my mind over this all day and any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source