I've found two possible solution of handling with variable-size input sequences for RNN in Keras. The solution one:
input = Input(shape=(None, num_classes))
then I can put any sequence size as an input for both training and validation.
The solution two:
input = Input(shape=(max_seq_length, num_classes))
...
pad_sequences(input_data, maxlen=max_seq_length, padding='post')
Which solution is recommended?
I consider benefits of these two. What I can see in the solution two is kind of validation of input size. The input cannot be larger than max_seq_size, moreover I can decide of type of padding (pre/post) and the same for timing of too large sequence.
What kind of padding and trimming is done using the solution one? Default parameters of pad_sequence?
I've benchmarked the time of training model for both solution and it's roughly the same time. I guess, that under the hood it's the same, like the max_seq_length is calculated from max length of training sequence, am I right?
Thank you for any clarification!