The 1st epoch:
input x1.
y1’ = model(x1), and store y1’. (y1’ requires grad)
calculate loss2 = L1(torch.op(y1’, y2’…)).
loss2.backward().
The next epoch:
input x2.
y2’ = model(x2), and store y2’. (y2’ requires grad)
calculate loss2 = L1(torch.op(y1’, y2’…)).
In the 2nd epoch, only y2’ need grad, y1’ and y3’ are constant results. so I should
set y1’.require_grad = False after the 1st epoch, after optimizer.step()?