Training LSTM with different sequence lengths in Keras functional api I am trying to train an LSTM model using Keras functional API. My training data is of shape:

&gt;&gt;&gt; data.shape()
(100000,variable_sequence_lengths,295)


where 100000 corresponds to the number of instances (the whole number of sequences) and 295 denotes the number of features in each element of a given sequence.

I am getting errors regarding the shape of the input data. How to define the shape of the data in the input layer and the subsequent one (LSTM) considering variable sequence lengths?

from keras.layers import Input, Dense, concatenate, LSTM
from keras.models import Model
import numpy as np

inputs = Input(shape=(x,y,z))
x=LSTM(128, return_sequences=True, input_shape=(a,b,c))(inputs)
....


What values should x, y, z and a, b, c take?
Model specification is per sample, number of samples should not be included in the dimensions, i.e. (a, b, c) or (sample_size, timesteps, dimension) should be changed to (timesteps, dimension). Also, for variable-length sequences, timesteps should be None. That is, (timesteps, dimension) should be (None, 295). The same goes for (x, y, z).

Please check out this post for feeding variable-length multi-dimensional sequences to Keras LSTM.