LSTM - unable to get a 3D output
I have an array with shape (55834, 250, 30)
and I'd like to get an output of the same shape from this LSTM model.
self.model = Sequential()
self.model.add(LSTM(
self.config.layers[0],
input_shape=(channel.X_train.shape[1], channel.X_train.shape[2]),
return_sequences=True))
self.model.add(Dropout(self.config.dropout))
self.model.add(TimeDistributed(Dense(
self.config.n_predictions)))
self.model.add(Activation('linear'))
self.model.compile(loss=self.config.loss_metric,
optimizer=self.config.optimizer, metrics=[mse])
self.model.fit(channel.X_train,
channel.y_train,
batch_size=self.config.lstm_batch_size,
epochs=self.config.epochs,
validation_split=self.config.validation_split,
callbacks=cbs,
verbose=True)
If I run it I get the error:
ValueError: Error when checking target: expected activation_1 to have 3 dimensions, but got array with shape (55834, 30)
Why am I losing one dimension? Doesn't the TimeDistributed layer recreate a 3D tensor?
Topic 3d-reconstruction lstm tensorflow deep-learning
Category Data Science