I would like to do the same, but accumulate loss in a loop as my model’s forward function returns a list of outputs.
My question is, how do I initialize the “loss” variable so that I can accumulate in a loop?