Thank you very much for your answer Chris @vdw. Your idea is actually easier so thank you for that!
If you let me, can I ask you one more question? I’ve been reading a lot about BPTT and now I’m confused with something else. As it can be seen on my train function, I compute the forward pass of my model n times (where n is the number of words in the sentence). After that, I only compute the loss (and back propagate) for the last word of the sentence, is that ok in your opinion?
I’ve seen math explanations, and they imply that I should compute the loss for every word in the sentence and then average that loss (In other words, take the word 1 and predict word 2, then take words 1 and 2 and predict word number 3 and so on), but I’m not sure about that aproach.
Can I have your thoughts about it? I’m really sorry is the question is too basic…