Why model.init_hidden() is needed in training but not in testing?

I see model.hidden = model.init_hidden() in the following example for the training using each sentence. Since it is used for training, shouldn’t it be used for testing as well?


I am relatively new to DL and Pytorch, so may be I am off the topic, but as “model.init_hidden()” is used to initialize the weight Matrix to random values or to 0 according to your defined function. Initialization is not required while testing, as we would already have set of well performing hyperparameters on training data, we would just load the saved parameters and test the data, the parameters doesn’t require to be initialized again. So, init_hidden() would only be required when training.