These are the differences I could see between the 2 methods of accumulating gradients:


Method1 uses more memory as it keeps the computation graphs of all 10 iterations in memory.
Where as, Method2 is memory efficient


In Method1, you are dividing gradient by 10 (i.e., averaging for 10 iterations). In Method2, there is no averaging taking place.