# LSTM / GRU prediction with hidden state?

I am trying to predict a value based on time series by series of 24 periods (the 25th period)

While training I have a validation set with I babysit the training (RMSE) and each epoch, eval the validation: Receive errors as:

Train RMSE: 3.02

Validation RMSE: 5.65
Validation r_squared: 0.75


However, when I evaluate the test (in the same size of the validation) I receive very bad results by:

    model.eval()
x_test = x_test.cuda()
y_test_pred, hidden = model(x_test)

Test RMSE: 8.18
Test r_squared: -5.62


I suspect the difference is that in the validation it creates while the model is training (performed model.eval()) so using the current hidden state and while test is with zero hidden state? How can the hidden state calculated for the test? The train and the test are not the same size..