code:
def build_lstm_model(input_shape):
    model = Sequential([
        LSTM(512, activation='relu', input_shape=input_shape, return_sequences=True),  # Adjusted for LSTM
        Dropout(0.20),
        LSTM(256, activation='relu', return_sequences=False),  # Additional LSTM layer
        Dropout(0.10),
        LSTM(128, activation='relu', return_sequences=False),  # Additional LSTM layer
        Dropout(0.10),
        Dense(128, activation='relu'),
        Dense(64, activation='relu'),
        Dense(32, activation='relu'),
        Dense(12),
    ])
    
    model.compile(optimizer='adam',
                  loss='mse',  # Use Mean Squared Error for regression
                  metrics=['mae'])  # Mean Absolute Error as an additional metric
    return model

error:
{
	"name": "ValueError",
	"message": "Input 0 of layer \"lstm_9\" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 512)",
	"stack": "---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[17], line 1
----> 1 model = build_lstm_model((30, 6427,))
      3 model.summary()

Cell In[16], line 2, in build_lstm_model(input_shape)
      1 def build_lstm_model(input_shape):
----> 2     model = Sequential([
      3         LSTM(512, activation='relu', input_shape=input_shape, return_sequences=True),  # Adjusted for LSTM
      4         Dropout(0.20),
      5         LSTM(512, activation='relu', return_sequences=False),  # Additional LSTM layer
      6         Dropout(0.10),
      7         LSTM(128, activation='relu', return_sequences=False),  # Additional LSTM layer
      8         Dropout(0.10),
      9         Dense(128, activation='relu'),
     10         Dense(64, activation='relu'),
     11         Dense(32, activation='relu'),
     12         Dense(12),
     13     ])
     15     model.compile(optimizer='adam',
     16                   loss='mse',  # Use Mean Squared Error for regression
     17                   metrics=['mae'])  # Mean Absolute Error as an additional metric
     18     return model

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\tensorflow\\python\\trackable\\base.py:205, in no_automatic_dependency_tracking.<locals>._method_wrapper(self, *args, **kwargs)
    203 self._self_setattr_tracking = False  # pylint: disable=protected-access
    204 try:
--> 205   result = method(self, *args, **kwargs)
    206 finally:
    207   self._self_setattr_tracking = previous_value  # pylint: disable=protected-access

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\keras\\utils\\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\keras\\engine\\input_spec.py:232, in assert_input_compatibility(input_spec, inputs, layer_name)
    230     ndim = shape.rank
    231     if ndim != spec.ndim:
--> 232         raise ValueError(
    233             f'Input {input_index} of layer \"{layer_name}\" '
    234             \"is incompatible with the layer: \"
    235             f\"expected ndim={spec.ndim}, found ndim={ndim}. \"
    236             f\"Full shape received: {tuple(shape)}\"
    237         )
    238 if spec.max_ndim is not None:
    239     ndim = x.shape.rank

ValueError: Input 0 of layer \"lstm_9\" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 512)"
}