chickenbestlover / RNN-Time-series-Anomaly-Detection

RNN based Time-series Anomaly detector model implemented in Pytorch.
Apache License 2.0
1.17k stars 316 forks source link

training loop #33

Closed dagap closed 4 years ago

dagap commented 4 years ago

In the training loop, I see the following code which I have trouble understanding:

for i in range(inputSeq.size(0)):
    outVal, hidden_, hid = model.forward(outVal, hidden_,return_hiddens=True)
    outVals.append(outVal)

So, first off, the variable i is used in an outer loop, so I am not sure if this has any detrimental or some side effect. I am guessing not but might be a good idea to change the variable names.

Most importantly, I was wondering the loop does not seem to go through the sequence. I was expecting that the model is going to see the sequence one point/token at a time but thatis not what seems to be happening. Could you kindly elaborate on this?