Where do you get the fixed length from?
On first sight, it looks like the training is done with a minibatch size of 1 2 and so the input_length in the train function’s for loop for ei in range(input_length): is just the length of the training input.
Best regards
Thomas