Two ideas…

param.grad is a Variable, so unless you zero_grads() during each iteration then they may be keeping their computation graphs. If so, then you can get around that by detaching them at the end of the loop.
If you keep track of the loss from one iteration to the next, then unless you do so using loss.data[0] it might be storing its computation graph with it.