delip / PyTorchNLPBook

Code and data accompanying Natural Language Processing with PyTorch published by O'Reilly Media https://amzn.to/3JUgR2L
Apache License 2.0
1.96k stars 799 forks source link

running_loss definition #21

Closed kd97 closed 4 years ago

kd97 commented 4 years ago

I can't understand the code running_loss += (loss_t - running_loss) / (batch_index + 1) I think loss_t means per current batch loss ,loss_t is less than running loss (loss_t - running_loss ?) can anyone explain it what the codes mean ?