In the part of “Sequence Models and Long-Short Term Memory Networks”, theres cods like this:
for epoch in range(300):  # again, normally you would NOT do 300 epochs, it is toy data
    for sentence, tags in training_data:
        # Step 1. Remember that Pytorch accumulates gradients.
        # We need to clear them out before each instance
        model.zero_grad()

        # Also, we need to clear out the hidden state of the LSTM,
        # detaching it from its history on the last instance.
        model.hidden = model.init_hidden()

        # Step 2. Get our inputs ready for the network, that is, turn them into
        # Tensors of word indices.
        sentence_in = prepare_sequence(sentence, word_to_ix)
        targets = prepare_sequence(tags, tag_to_ix)


My question is, If every time when u train on a new batch or a new sequence training example, then if u clean the hidden state which means u just give up the parameters u have trained about. Then in the next epoch, u are doing repeat meaningless things, just like the epoch before cause ur paramters are zero again. So I really cant understand why here we use “model.hidden = model.init_hidden()”
Can anyone help me out? I have been considering this question for a whole day although I know im wrong and it seems really stupid hahaha…
Thanks in advance!