I am now reading the pytorch tutorial on name/country classification (see the Classifying Names with a Character-Level RNN). After the training, in chapter evaluate result, the
evaluate() function will take a name and predict which language it belongs too. But it will give a hidden input of all zero as the input. My question is, we already have a trained internal state in the training, shall we always reuse it, or discard it every time? Or what is the recommended treatment of the internal state among different evaluation?
# Just return an output given a line def evaluate(line_tensor): hidden = rnn.initHidden() for i in range(line_tensor.size()): output, hidden = rnn(line_tensor[i], hidden) return output