In Keras, how to get 3D input and 3D output for LSTM layers
Add another dimension to represent the number of time steps.

From Keras documentation on recurrent layers:


  if return_sequences: 3D tensor with shape  (batch_size, timesteps,
  units).


Something like this:

model = Sequential()
model.add(LSTM(12, input_shape=(40, 10, 3), return_sequences=True))