Thanks so much for your reply!
So after accumulating loss or getting gradients, what variables need to be detached?